[AccessD] Access 2007 - Type Mismatch

Gale Perez galeper at gmail.com
Thu Jun 21 15:38:48 CDT 2007


Hi!

After converting a 2003 db to 2007, I'm getting a "Type Mismatch" error in a
field's BeforeUpdate code (the code checks to ensure the value hasn't
already been used).  The field is a text field, so the problem shouldn't be
that its value is in quotes.  Has anyone else experienced this or have any
ideas?  It worked fine before.

Thank you very much (code below),
Gale


Dim strSQL As String
strSQL = "SELECT * FROM MyTable WHERE MyField = " & Chr$(34) & Me!MyField &
Chr$(34)

Dim db As Database
Set db = CurrentDb

Dim rst As Recordset
Set rst = db.OpenRecordset(strSQL)

If Not (rst.EOF And rst.BOF) Then
    Cancel = True
    msgbox "This number has already been used.", etc.
End If



More information about the AccessD mailing list