Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Run time error 3075 2

Status
Not open for further replies.

ZeoGel

Technical User
May 13, 2003
28
US
I am tring to update fields on a continoues form, on only certian records. Here is my code but i keep getting a

"Syntax Error (Missing operator in query expression"

Private Sub Combo47_AfterUpdate()

Dim db As DAO.Database, sSQL As String

Set db = CurrentDb()

sSQL = "UPDATE qryEnrollment SET CourseID =" & Chr(34) & Me.[Combo47] & " WHERE [ClassID] =" & Chr(34) & Me.classID.Value & Chr(34)

db.Execute sSQL
 
You may try this:
Code:
sSQL = "UPDATE qryEnrollment SET CourseID='" & Me!Combo47 & "' WHERE ClassID='" & Me!classID & "'"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I expect this might be caused by a missing Chr(34) or similar. I assume CourseID is text. You should learn some debugging methods such as:
Code:
  sSQL = "UPDATE qryEnrollment SET CourseID =" & Chr(34) & Me.[Combo47] & " WHERE [ClassID] =" & Chr(34) & Me.classID.Value & Chr(34)
    Debug.Print "sSQL: " & sSQL
    [green]'db.Execute sSQL [/green]

Try:
Code:
  sSQL = "UPDATE qryEnrollment SET CourseID =""" & _
     Me.[Combo47] & """ WHERE [ClassID] =""" & _ 
     Me.classID.Value & """"

BTW: I would change the name of Combo47 to make your application more self-documented.

Duane
Hook'D on Access
MS Access MVP
 
Thank you both for the quick response. It work great with both codes.

"BTW: I would change the name of Combo47 to make your application more self-documented." by dhookom

I normally do change the names but i was in a bit of a newbie laps. hehe

Thanks again both of you guys.
Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top