Query Criteria ( In Runtime )

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Query Criteria ( In Runtime )

Post by D Willett »

Strange
In a query I use: ">=Date()-5" as criteria to show records from 5 days ago. The full query:

SELECT tblSales.SalesOrderID, tblSales.Customer, tblSales.Item, tblSales.[Payment Method], tblSales.FitDate, tblSales.FitTime, tblSales.FitDuration, tblSales.FitDone
FROM tblSales
WHERE (((tblSales.FitDate)>=Date()-5) AND ((tblSales.FitDone)=False))
ORDER BY tblSales.FitDate;

In the runtime version of one pc I get the following error, but other pc's on runtime are ok:
You do not have the required permissions to view the files attached to this post.
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78656
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Query Criteria ( In Runtime )

Post by HansV »

It looks like one of the libraries used by the database is missing or not in the expected place on the 'problem' PC.
You can inspect the libraries used in the Visual Basic Editor, by selecting Tools | References...
Do you use non-standard libraries?
Best wishes,
Hans

User avatar
Rudi
gamma jay
Posts: 25455
Joined: 17 Mar 2010, 17:33
Location: Cape Town

Re: Query Criteria ( In Runtime )

Post by Rudi »

Hi Dave,

Some more info about it to add to Hans's comments...

See this KB article (http://support.microsoft.com/kb/194374) that describes the issue and presents a resolution.
A quick scan on the we also indicates that it is a reference issue in the VBA libraries.

Another links about it:
-- http://www.pcreview.co.uk/forums/funtio ... 55785.html
Regards,
Rudi

If your absence does not affect them, your presence didn't matter.

D Willett
SilverLounger
Posts: 1728
Joined: 25 Jan 2010, 08:34
Location: Stoke on Trent - Staffordshire - England

Re: Query Criteria ( In Runtime )

Post by D Willett »

Cheers guys. Didn't have time to reply on Saturday. I gathered it was a reference issue, not being registered in older versions of Office.
I did resolve it this morning, changed the "Date()" to "Now()" and it works fine.
However I do try to steer away from Now() because of the time element tagged to the end.
But, for this ourpose it is fixed.

Thanks again Guys.
Cheers ...

Dave.

User avatar
HansV
Administrator
Posts: 78656
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Query Criteria ( In Runtime )

Post by HansV »

It's good that you found a workaround, but be alert for the same or a similar problem popping up - missing references can cause weird problems.
Best wishes,
Hans