Different DATE behaviour for same code on different PCs.

T

ThomasAJ

The date is used in a query definition in the "Where..." part.
The code is:
WHERE (((GuestStay.GuestID)=" & lngGuestID & ") AND ((DateDiff(""d"",#" &
dteCancelledDate & "#,[GuestStay.StayCreated])) Between 0 And " & intDays &
"))

I copied the ENTIRE Function that the above code is part of (and the calling
routine that supplies the date used by 'dteCancelledDate') from one machine
to another. The data is the same as well on both machines.

On one machine the records are found but on another they are not.

The date settings on both PCs are identical (in Regional and Language
Options). I looked at Access options but could not see any difference.

The ONLY way that it would work on the 'bad' PC was to make a date via
concatination to replace 'dteCancelledDate' using DATEPART. I put together
m/d/yyyy in place of 'dteCancelledDate'. (ie DatePart("d",dteCancelledDate)
etc
 
P

Paolo

Hi Tom,

use the format function on dtecancelleddate to be sure of the way the date
is used i.e. format(dtecancelleddate,"mm/dd/yyyy")

HTH Paolo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top