F
Flannel
I'm trying to write a SELECT statement that uses WHERE to
find a match. The WHERE piece is pointing to a list box on
a form.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = ("SELECT * FROM Table WHERE TableField = '" &
Forms!MainForm!ListBox & "'")
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL)
I'm getting a "Data Type mismatch in criteria expression"
error.
I have narrowed the issue down to my WHERE statement piece.
Even if I try to hard code something in it doesn't work:
"SELECT * FROM Table WHERE TableField = 'Testing'"
Thanks
find a match. The WHERE piece is pointing to a list box on
a form.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = ("SELECT * FROM Table WHERE TableField = '" &
Forms!MainForm!ListBox & "'")
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL)
I'm getting a "Data Type mismatch in criteria expression"
error.
I have narrowed the issue down to my WHERE statement piece.
Even if I try to hard code something in it doesn't work:
"SELECT * FROM Table WHERE TableField = 'Testing'"
Thanks