Currentdb.Execute "INSERT INTO tblRegister(Surname,FirstName,MiddleName,Email)" & _
    " VALUES(" & Me.txtSurname & ",'" & Me.txtFName & "','" & Me.txtMName & "','" & Me.txtEmail & "')"

The code above gives me run time error 3061: Too Few parameter: expected 1

Also, I discovered that when I typed (1) the figure (1) into the surname textbox on my form. It inserts into the table tblRegister without the error. How can I make it insert name (letter) into the surname and not a number? Thanks in advance for the answer
Ukaoha EzeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

John TsioumprisSoftware & Systems EngineerCommented:
Try this
Currentdb.Execute "INSERT INTO tblRegister(Surname,FirstName,MiddleName,Email)" & _
    " VALUES('"  & Me.txtSurname & "','" & Me.txtFName & "','" & Me.txtMName & "','" & Me.txtEmail & "')"

Open in new window

Ryan ChongSoftware Team LeadCommented:
you should do this in case the user is entering single quote ' in to the text fields for better error handling.

Currentdb.Execute "INSERT INTO tblRegister(Surname,FirstName,MiddleName,Email)" & _
    " VALUES('" & replace(Me.txtSurname,"'","''") & "','" & replace(Me.txtFName,"'","''") & "','" & replace(Me.txtMName,"'","''") & "','" & replace(Me.txtEmail,"'","''") & "')"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ukaoha EzeAuthor Commented:
Thanks so much. It all worked very well. Actually.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Ryan ChongSoftware Team LeadCommented:
which comment(s) works for you? you may proceed to close this question.
Ryan ChongSoftware Team LeadCommented:
please comment before we close this question.
Ryan ChongSoftware Team LeadCommented:
suggested solutions resolved the issue.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.