I get a Data type mismatch error when I try to run the following code:
Dim myString As String
Dim rs As Recordset
sSQL = "SELECT * FROM KLIST WHERE KLIST = " & Me.bleh
Set rs = CurrentDb.OpenRecordset(sSQL)
myString = rs.Fields("DATEK")
The "bleh" field is a normal text field in a form. The field "KLIST" in the "KLIST" table is also a text field, containing numbers.
Does the fact that i enter numbers in the text field in the form change the format of the field? And if it does, how can I compare them in the WHERE statement.
Thanks.
sSQL = "SELECT * FROM KLIST WHERE KLIST = '" & Me.bleh & "'"
- Dmitry PavlivSELECT * FROM KLIST WHERE TRIM(KLIST) = 'x'
wherex
is value ofMe.bleh
. Does it retrives your records? - Dmitry PavlivsSQL = "SELECT * FROM KLIST WHERE TRIM(KLIST) = '" & TRIM(Me.bleh) & "'"
- Dmitry Pavliv