HELP: Syntax error (missing operator) Query Expression



Hi All, I am gettin a Syntax error (missing operator) Query Expression
'Student_Name = JAMES JAMES' on this line:

Set rst = conn.Execute(strSQL)

Basically, I want to pull details from access into userform fields based on
what I enter in StudentName text field, Here is the code for that event:

Private Sub StudentName_Change()

Dim conn As Object, rst As Object, strSQL As String

Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.ACE.OLEDB.12.0; " & _
"Data Source=C:\My Documents\Student_Data.accdb;" & _
"Jet OLEDB:Database Password=students;"

strSQL = "SELECT Student_Number, Student_Email, Student_Phone,
Student_Location" & _
" FROM Student_Table WHERE Student_Name = " &

Set rst = conn.Execute(strSQL) '<------- ERROR in this line

Thanks in advance


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question