I have spent several hours trying to debug this code. I have not been able to find the answer anywhere.
I have an Access DataBase I am running Access 2010. I want to search the DB to see if a record with several criteria already exists.
I am able to make it work with a single criteria but as soon as I put in an AND or OR I get one or more errors. In the below code the line with the And in it does not work but if I run either of the two lines below it, it works fine.
I hope you can help me .
Thanks Doug
I have an Access DataBase I am running Access 2010. I want to search the DB to see if a record with several criteria already exists.
I am able to make it work with a single criteria but as soon as I put in an AND or OR I get one or more errors. In the below code the line with the And in it does not work but if I run either of the two lines below it, it works fine.
I hope you can help me .
Thanks Doug
VBA Code:
With KAH_Record
'The first line DOES NOT work, the next two lines do work. I would like to be able to do
'about 4 different criteria at one.'
.FindLast "[Payment Method]= '" & PayMethod & "'" And "[EMail]= '" & EMail & "'"
.FindLast "[Payment Method]= '" & PayMethod & "'"
.FindLast "[EMail]= '" & EMail & "'"
If .NoMatch = False Then
MsgBox "Found Match"
'Get_Record_Request = False
'Exit Function
Else
MsgBox "Not Found"
End If