Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date filter problem in Access 2002 1

Status
Not open for further replies.

cP6uH

Programmer
May 21, 2003
17
0
0
CA
I have a report, and when I click a button for report preview, follwing code is executed:

sCriteria = ([Date of First Issue] <= #&quot; & [Forms]![DirectivesForm].[cboLastDate] & &quot;#&quot;
stDocName = &quot;Report&quot;
DoCmd.OpenReport stDocName, acViewPreview, , sCriteria, acWindowNormal

Now, this should show all records up to the date selected, and it does that on the computer the database was created.
This database is in network envoirnment, and it can be accessed from any computer in the network.
Now, the problem is, as I said it filters the report query right on the computer that the database was created, but, it doesn't do the right job in any other computer on the network.
It filters some of the dates correctly, but then some others are not correct. For example: If i pick Friday, June 6th as the date, it filters all records up to June 6th, but if I pick June 7th, it filters all records up to June 10th... And as I said, it does that on all computers except the one on which database was created.

Any suggestions how to fix this problem ??

Thank you
Dragan
 
This may be a problem with international settings on the computers. When you think you are selecting June 7th, Access is interpreting this as July 6th. To check if this is not correct, do you have any records beyond June 10th.
 
I use CDbl() to help. Like this:

sCriteria = (CDbl([Date of First Issue]) <= &quot; & CDbl([Forms]![DirectivesForm].[cboLastDate])

 
PauloRico, you are right, that is the problem. I changed some records to see if that is the case, and it was.

I changed one record to December 6th, and it didn't show up until i picked June 12th.

So, how do I correct this ?
 
This should do it -

Dim dtmDate as Date

dtmDate=[Forms]![DirectivesForm].[cboLastDate]

sCriteria = ([Date of First Issue] <= #&quot; & Format(dtmDate,&quot;mm&quot;) & &quot;/&quot; & Format(dtmDate,&quot;dd&quot;) & &quot;/&quot; & Format(dtmDate,&quot;yy&quot;) & &quot;#&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top