Your syntax is correct if:
- ID is a Number type field,
- cmdIdNumber is a combo(?), and the bound column is a number,
- Ctgry is a Text type field,
- The bound column of cmdCategory is the correct text,
- There is no apostrophy in the text in cmdCategory.
You could try adding brackets and using double quotes, e.g.:
strCriteria = "([ID] = " & Me.cmdIDNumber & ") AND (Ctgry = """ & _
Me.cmdCategory & """)"
If it still doesn't work, get each half to work on its own.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<to*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hello, I was wondering if anyone could help me with this. I've done
some searching and found it's a common problem:
I'm trying to search a recordset that has two key fields: One is a long
and the other a string
strCriteria = "ID=" & Me.cmdIDNumber & " AND Ctgry='" &_
Me.cmdCategory & "'"
With Me.RecordsetClone
.FindFirst strCriteria
End With
Unfortunately, when I run the operation, I get an "Invalid syntax
(Missing Operator)" function. I've tried time and time again with
different methods. Any help!
Thank you very much in advance.