FindFirst...

wh00t

Registered User.
Local time
Today, 15:37
Joined
May 18, 2001
Messages
264
I am working on creating a holiday booking database, and am currently trying to get the form to look and see if a person has booked a certain day already. I am using findfirst but it's not going quite how I wanted.

this is the part of the code I'm having trouble with

Code:
StrStaffSearch = Str(Me!Staff)
StrDateSearch = Str(Me!StartDate)

rst.FindFirst "DateID = " & StrDateSearch And "StaffID = " & StrStaffSearch

I get a Type Mismatch error

when I use just one of the criteria values it works ok, but not with both.

How can I make it so that it searches on both criteria?
 
no

the Me!StartDate is a combo box with the DateID field as it's root which is a number.
 
First, if this is your code then you are missing an &

rst.FindFirst "DateID = " & StrDateSearch And "StaffID = " & StrStaffSearch

rst.FindFirst "DateID = " & StrDateSearch & " And {remove double quote}"StaffID = " & StrStaffSearch

Also if it is a date then it ought to be: "DateID = #" & strDateSearch & "# And StaffID = " & strStaffSearch

HTH
 

Users who are viewing this thread

Back
Top Bottom