Run-Time Error 3075: Syntax Error (Missing Operator) in Query Expression

Run-Time Error 3075: Syntax Error (Missing Operator) in Query Expression 'Lee' When I enter Lee in the name box

CurrentDb.Execute "INSERT INTO tblMRecord2 (Ename,Adate,Clinic,BilNo,Remarks,MLeave,MFees) Values (" & Me.Ename & "," & Me.Adate & "," & Me.txtClinic & "," & Me.txtBilNo & "," & Me.txtReasons & "," & Me.txtMLeave & ", " & Me.txtMFees & ");"

Open in new window

Poop HolyAsked:
Who is Participating?
 
Éric MoreauConnect With a Mentor Senior .Net ConsultantCommented:
You need to surround your strings with quotes, your dates with #

CurrentDb.Execute "INSERT INTO tblMRecord2 (Ename,Adate,Clinic,BilNo,Remarks,MLeave,MFees) Values ('" & Me.Ename & "',#" & Me.Adate & "#,'" & Me.txtClinic & "','" & Me.txtBilNo & "','" & Me.txtReasons & "','" & Me.txtMLeave & "', '" & Me.txtMFees & "');"

Open in new window

0
 
Gustav BrockCIOCommented:
You asked for the same here:

compile error: expected end of statement

and you got answers, so just implement those answers.
It is not only the Name field (now Ename) that fails, it is also most of the other fields that will fail.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.