LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default HELP: Syntax error (missing operator) Query Expression

Try this

" FROM Student_Table WHERE Student_Name = '" &
Trim(Me.StudentName.Value) & "'"

"sam" wrote:

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 = " &
Trim(Me.StudentName.Value)

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

Thanks in advance

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using cell reference with logical operator in DGET expression BoxleyFarm Excel Worksheet Functions 1 April 28th 10 11:31 AM
syntax error in VBA in query from Access Winget Excel Discussion (Misc queries) 0 January 21st 10 07:49 PM
SQL Syntax Error in Query jim hardwick[_2_] Excel Programming 2 December 5th 07 09:44 PM
Syntax error (missing operator) in query expression '6 Wescott Rd# shealy Excel Discussion (Misc queries) 0 June 9th 05 09:53 PM
Macro syntax error when running query rrmando Excel Programming 0 July 26th 04 10:42 PM


All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"