Reputation: 604
I am checking table records for duplicates using Recordset. I have this code in about 5 forms with exactly same settings, but on one of them corde doesn't work - I'm receiving error 3464 : "Data type mismatch in criteria expresion":
Dim rs As Recordset
Set rs = CurrentDb.OpenRecordset("MyTable", dbOpenSnapshot)
rs.FindFirst "[Field_With_Numbers] = " & Me![Field_With_Numbers]
What is wrong ?? The only difference from other forms is that this both fields are Text and they store numbers. Any other alternatives, please advise !
Upvotes: 0
Views: 113
Reputation: 27634
If the field is a text field, you need to treat it as such, no matter what it actually stores.
rs.FindFirst "[Field_With_Numbers] = '" & Me![Field_With_Numbers] & "'"
Upvotes: 0