FindFirst with Multiple Criteria

Gannet

Registered User.
Local time
Today, 05:12
Joined
Sep 21, 2006
Messages
55
I'm trying to find a record based on multiple criteria.

Code:
Dim db As Database
Dim rs As Recordset
Dim Criteria As String

Set db = CurrentDb
Set rs = db.OpenRecordset("tblCalendarEvents")

Criteria = "[date_of]=#" & ctldate & "# AND [sbjID]='" & strSbjID & "' AND [choices]='" & strChoice & "'"
       
rs.FindFirst Criteria

I'm getting the error 3251
"Operation is not supported for this type of object"

I use the same criteria string for my DLookup without any problems.
Any ideas?
 
might be spacing - try putting spaces in front and behind = signs

also, display the criteria in a msgbox to make sure it looks ok first, although it looks right.
 
Still not working

I would like to know why this code doesn't work but in the mean time I've just created a delete query.

Code:
strSQL = "DELETE tblCalendarEvents.sbjID, tblCalendarEvents.date_of, tblCalendarEvents.choices " & _
          "FROM tblCalendarEvents " & _
          "WHERE (((tblCalendarEvents.sbjID)='" & strSbjID & "') AND ((tblCalendarEvents.date_of)=#" & ctldate & "#) AND ((tblCalendarEvents.choices)='" & strChoice & "'));"
                           
DoCmd.SetWarnings False
DoCmd.RunSQL (strSQL)
DoCmd.SetWarnings True
 

Users who are viewing this thread

Back
Top Bottom