Link to home
Start Free TrialLog in
Avatar of marku24
marku24Flag for United States of America

asked on

SQL Syntax in Access VBA

I am trying to INSERT data from a form into a table in Access using SQL in VBA.  I am getting an error telling me "Too Few Parameters - Expected 3".  

Here is my statement:
strSQL = "INSERT INTO tblHeadcountRequestRepository (LastEditedBy, NH_Region, NH_Function, NH_Office)VALUES(" & frmUser & "," & strReq_Region & "," & strReq_F3 & "," & strReq_OFC & ")"
            db.Execute (strSQL)

Here are the values from the immediate window:
INSERT INTO tblHeadcountRequestRepository (LastEditedBy, NH_Region, NH_Function, NH_Office)VALUES(unganm,Americas,URT,Burlington)

Is my SQL statement written incorrectly?  

Thanks
ASKER CERTIFIED SOLUTION
Avatar of PatHartman
PatHartman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of marku24

ASKER

Worked perfectly.  The single and double quotes always get me.
It gets more confusing when you have to embed double quotes.  Glad the single quotes will work for you.