Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 8th, 2005, 05:02 PM
Registered User
 
Join Date: Aug 2004
Location: Eden Praire, MN, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL query dropping parameter function...

Hey everyone,

I have a query that references a function I built in VB to return the number of working days between today and 4 months future. For some reason the query will work fine 3 or 4 times and then it will suddenly erase the function name from the query and start asking me to manually enter working days... If I go back in and re-enter the sql statement, when I save it, it erases the function name again. the only things that fixes it is to do a compact & repair.

Any suggestions???

Oh, and here is the relevant bits of the SQL statement, both before and after...

BEFORE
Code:
PARAMETERS intNumWorkDays INTEGER = Get_NetWorkDays();
SELECT
  tblSCPFBRT_SCPSTAT.KTN_PN,
  tblSCPFBRT_SCPSTAT.WHS,
  tblSCPFBRT_SCPSTAT.VEN_NUM,
  tblSCPFBRT_SCPSTAT.BGN_AVAIL,
  ROUND(tblSCPFBRT_SCPSTAT.COST, 2) AS COST,
  ROUND(((tblSCPFBTS.FCST_TOTAL + tblSCPIPTS.DPNDT_QTY)
          /intNumWorkDays), 2) AS AVG_DMND,
  CINT(intNumWorkDays) AS WRKNG_DYS,
  ROUND(IIF(((tblSCPFBTS.FCST_TOTAL + tblSCPIPTS.DPNDT_QTY)
              /intNumWorkDays) = 0, 999,
        IIF(tblSCPFBRT_SCPSTAT.BGN_AVAIL > 0,
            tblSCPFBRT_SCPSTAT.BGN_AVAIL, 0)
            / ((tblSCPFBTS.FCST_TOTAL + tblSCPIPTS.DPNDT_QTY )
            / intNumWorkDays )), 0) AS DOH,
  CLNG(NZ(tblSCPDRPU.M0, 0)) AS MTH0,
  CLNG(NZ(tblSCPDRPU.M1, 0)) AS MTH1,
  CLNG(NZ(tblSCPDRPU.M2, 0)) AS MTH2,
  CLNG(NZ(tblSCPDRPU.M3, 0)) AS MTH3
INTO
  tblPIPELINE
FROM
  ((tblSCPFBTS INNER JOIN tblSCPIPTS ON tblSCPFBTS.SCP_UID = tblSCPIPTS.SCP_UID) INNER JOIN
  (tblSCPFBRT_SCPSTAT LEFT JOIN tblSCPDRPU ON tblSCPDRPU.SCP_UID = tblSCPFBRT_SCPSTAT.SCP_UID)
  ON tblSCPFBRT_SCPSTAT.SCP_UID = tblSCPFBTS.SCP_UID);


AFTER
Code:
PARAMETERS intNumWorkDays Long;
  ... same as above
  #2 (permalink)  
Old March 14th, 2005, 11:20 AM
ru1 ru1 is offline
Authorized User
 
Join Date: Feb 2005
Location: Detroit, MI, USA.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jack. It sounds like you have an Access Problem, not a function problem. Try this: Create a blank database, import all your objects into the blank database and then try running your function. If there are still problems, ask your system admin if he will take a look at your "MSACCESS.PIP" file.

Hope this helps.

RU1



  #3 (permalink)  
Old March 14th, 2005, 04:56 PM
Registered User
 
Join Date: Aug 2004
Location: Eden Praire, MN, USA.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ru1
 Jack. It sounds like you have an Access Problem, not a function problem. Try this: Create a blank database, import all your objects into the blank database and then try running your function. If there are still problems, ask your system admin if he will take a look at your "MSACCESS.PIP" file.

Hope this helps.

RU1
Hello RU1,

Thanks for the reply... Unfortunately, this solution did not work for me. I recreated the DB from scratch and I am still having the same problem.

As for the PIP file, I need a little more information before I can go to our IS support desk. What exactly would the personal menu file (PIP) have to do with my UDF problem and why should the system admin look at it?

Thanks!



Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing function parameter to query kar22 Access 1 February 27th, 2007 08:28 AM
How to pass Table Name as a parameter in SQL query visualbrin Reporting Services 1 October 13th, 2006 04:08 PM
Howtouse QueryString parameter in a <sql:query>tag chauhan_vin JSP Basics 0 May 3rd, 2005 01:01 AM
SQL Query - VAL Function itHighway Classic ASP Databases 2 February 23rd, 2005 11:55 PM
sql query VAL function itHighway Classic ASP Basics 1 February 23rd, 2005 11:55 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.