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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date format puzzle.

Status
Not open for further replies.

JMM

Technical User
Feb 17, 2000
37
NZ
The following code is supposed to show date in a search function.

strSearch = "[" & fld.Name & "] = #" & Me.Date & "#"

It sort of works but not correctly. My date format is UK ie. dd/mm/yy. If I enter dd/mm/yy into the 'Search for' box it says there are no records. However if I enter mm/dd/yy it finds records where the date actually is dd/mm/yy. The machine's settings is for dd/mm/yy and the data is entered in this format.
What is wrong with the code. Any ideas.
 
JMM,

you always have to use mm/dd/yy format in queries, regardless of everything. Try this:

strSearch = "[" & fld.Name & "] = #" & Format("mm/dd/yy",Me.Date) & "#"

Hope it helps.
Mangro



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top