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!

FindFirst with Date and String Problem

Status
Not open for further replies.

EddyLLC

Technical User
Mar 15, 2005
304
US
I'm using the following FindFirst but getting a Invalid Syntax error. Both variables (strNumber1 and strDate) are dimmed as strings. The field [Date] is a date field so I use the CDate to convert the string into a date.

Any thoughs on what I am doing wrong? Thanks

rst.FindFirst "[Number1] = '" & strNumber1 & "' And [Date] = '" & CDate(strDate)
 
Date fields have to be delimited by hash characters. For example:

rst.FindFirst "[Number1] = '" & strNumber1 & "' And [Date] = #" & CDate(strDate) & "#"

John
 
And if the field [Number1] is a numeric field:
rst.FindFirst "[Number1]=" & strNumber1 & " And [Date]=#" & CDate(strDate) & "#"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top