FindFirst method help

ppataki

Registered User.
Local time
Today, 14:58
Joined
Sep 5, 2008
Messages
267
Dear All,

I have a query that has one output field, a date field.
I need to check if the value of a field on a form is in the recordset or not (the field is also a date type)
When I run the below code I get error message:
"Runtime error 3077. Syntax error in date in expression"

Code:
Private Sub HolidayDate_BeforeUpdate(Cancel As Integer)
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("qry_constant_holidays_list", dbOpenDynaset)
rs.FindFirst "[Holidays] = #" & Me.HolidayDate & "#"

Could you please advise?
Many thanks in advance
 
Try format the dateexpression to use USdates mm/dd/yyyy

rs.FindFirst "[Holidays] =" & Format(Me.HollidayDate, "\#mm\/dd\/yyyy\#")

JR
 
Thank you very much, it works like a charm!!
 

Users who are viewing this thread

Back
Top Bottom