I'm using FindFirst method in Access VBA to find a particular record in a recordset. I have 2 search criteria each of which works just fine if used separately as an argument in FindFirst, but NOT in combination with one another. I tried various combinations of quotes, double quotes, brackets and paranthesis but in case of using 2 conditions I'm still receiving the error message saying "run-time error 13 - type mismatch". If I use just one of them then there are no error codes, so it looks like I simply can't remember the right syntax, i.e. there aren't, in fact, any data type mismatches.
This is the code that doesn't work:
Set rst = dbs.OpenRecords et("tblCustomer ", dbOpenDynaset)
With rst
.FindFirst "[CustID] = ' " & rstOtherTBL!Cus tID & " ' " And _
"[Date] = #" & StartDate & "# "
'Other Statements
End With
However, these 2 pieces of code work just fine:
Set rst = dbs.OpenRecords et("tblCustomer ", dbOpenDynaset)
With rst
.FindFirst "[CustID] = ' " & rstOtherTBL!Cus tID & " ' "
'Other Statements
End With
Set rst = dbs.OpenRecords et("tblCustomer ", dbOpenDynaset)
With rst
.FindFirst "[Date] = #" & StartDate & "# "
'Other Statements
End With
Anybody knows how to resolve it?
Thanks a lot in advance!
This is the code that doesn't work:
Set rst = dbs.OpenRecords et("tblCustomer ", dbOpenDynaset)
With rst
.FindFirst "[CustID] = ' " & rstOtherTBL!Cus tID & " ' " And _
"[Date] = #" & StartDate & "# "
'Other Statements
End With
However, these 2 pieces of code work just fine:
Set rst = dbs.OpenRecords et("tblCustomer ", dbOpenDynaset)
With rst
.FindFirst "[CustID] = ' " & rstOtherTBL!Cus tID & " ' "
'Other Statements
End With
Set rst = dbs.OpenRecords et("tblCustomer ", dbOpenDynaset)
With rst
.FindFirst "[Date] = #" & StartDate & "# "
'Other Statements
End With
Anybody knows how to resolve it?
Thanks a lot in advance!
Comment