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

How do you do a findfirst with a date/time value

Status
Not open for further replies.

Pack10

Programmer
Feb 3, 2010
495
US
What is the proper way to do a findfirst or a dlookup with a date time value. For instance, if I have a value 06/27/2011 11:27:18 AM.
How should the findfirst be coded... Mine sometimes does not find the record and I know it's there.
 
What is your code, what are the datatypes of the involved fields?
 
Field data types are date time, the value that the user selects is
A date time value. The find and the dlookup are not locating the record while I know it's there. This is a date time that I am
Trying to pull from the tables. Should I be using seek.
 



Code, Code, Code!

It was requested and you ignored!

CODE PLEASE!

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
I got it to work by basing it on this code....

rs.FindFirst "DateValue([YourDateField]) = #" & Format(Dates.DateOfBooking, "yyyy-mm-dd") & "#" & _
" And TimeValue([YourTimeField]) = #" & TimeValue(Dates.TimeOfBooking) & "#"
 
how about


"DateValue([YourDateField]) = #" & Dates.DateOfBooking & " " & Dates.TimeOfBooking & "#
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top