Aman K
Aman K

Reputation: 1

Run-Time error '3075' Access

Hey everyone I keep getting the following error, Run-Time error '3075': syntax error in string in query expression "0,")'

CurrentDb.Execute "INSERT INTO MobileDeviceUserList(sUser, sDevice, sMobileNumber, sIMEINumber, sSerialNumber, sAccessories, sNewSIMNumber, sComments, sRecorded) " & _
 "VALUES (" & Me.cboDevice & ",'" & Me.cboAccessories & ",'" & Me.txtUser & ",'" & Me.txtNumber & ",'" & Me.txtIMEI & ",'" & Me.txtSerial & ",'" & Me.txtNEWSIM & ",'" & Me.recRecorded & ",'" & _
 Me.txtComment & "')"

Upvotes: 0

Views: 732

Answers (2)

user4039065
user4039065

Reputation:

You are misplacing ticks (e.g. ' ) in the string construction. Probably through copy and paste errors.

Example:

... & ",'" & Me.cboAccessories & ",'" & Me.txtUser & ",'" & Me.txtNumber & ",'" & ...

... should be something closer to,

... & ",'" & Me.cboAccessories & '",'" & Me.txtUser & '"," & Me.txtNumber & ",'" & ...

I cannot supply a foolproff answer as I do not know what fields are text, numeric, dates or memos. Maybe do a string construction into a string var and debug.print the var to see the result.

Upvotes: 0

Vityata
Vityata

Reputation: 43565

  1. Start pressing F8 until you reach the problematic string
  2. Press Ctrl + G.
  3. Write exactly this on what you see:

?"INSERT INTO MobileDeviceUserList(sUser, sDevice, sMobileNumber, sIMEINumber, sSerialNumber, sAccessories, sNewSIMNumber, sComments, sRecorded) " & _
 "VALUES (" & Me.cboDevice & ",'" & Me.cboAccessories & ",'" & Me.txtUser & ",'" & Me.txtNumber & ",'" & Me.txtIMEI & ",'" & Me.txtSerial & ",'" & Me.txtNEWSIM & ",'" & Me.recRecorded & ",'" & _
 Me.txtComment & "')"
  1. The "Debugging" should be quite easy now and the error must be evident.

Upvotes: 1

Related Questions