S
sam
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 OLEDBatabase Password=students;"
strSQL = "SELECT Student_Number, Student_Email, Student_Phone,
Student_Location" & _
" FROM Student_Table WHERE Student_Name = " &
Trim(Me.StudentName.Value)
Set rst = conn.Execute(strSQL) '<------- ERROR in this line
Thanks in advance
'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 OLEDBatabase Password=students;"
strSQL = "SELECT Student_Number, Student_Email, Student_Phone,
Student_Location" & _
" FROM Student_Table WHERE Student_Name = " &
Trim(Me.StudentName.Value)
Set rst = conn.Execute(strSQL) '<------- ERROR in this line
Thanks in advance