Inster INTO Table Not Working

AsifShah

Board Regular
Joined
Feb 12, 2021
Messages
70
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello Evory One ... im new in Access please some on help me on Inster into sql commond .. my code is not working.

my code is
SQL:
Dim strInsert As String

strInsert = "INSERT INTO Users (ID, FirstName, LastName, Password, ConfirmPassword, SecurityQuestion, Designation, Mobile, Answer, Picture)" & _
"values ('" & Me.txtID & "', '" & Me.FirstName & "', '" & Me.LastName & "', '" & Me.Password & "', '" & Me.ConfirmPassword & "', '" & Me.SecurityQuestion & "', '" & Me.Designation & "', '" & Me.Mobile & "', '" & Me.Answer & "', '" & Me.txtPicture & "');"

DoCmd.SetWarnings False
DoCmd.RunSQL strInsert
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You do not say why it is not working? :(

Start getting used to using Debug.Print

Use that on strInsert and that should show you your error.
 
Upvote 0
One thing that might be a problem - I think you might need a space between ")" and "values".
Note that you can combine this part:
SQL:
strInsert = "INSERT INTO Users (ID, FirstName, LastName, Password, ConfirmPassword, SecurityQuestion, Designation, Mobile, Answer, Picture)" & _
"values ('"
to this:
SQL:
strInsert = "INSERT INTO Users (ID, FirstName, LastName, Password, ConfirmPassword, SecurityQuestion, Designation, Mobile, Answer, Picture) values('"
 
Upvote 0
Solution
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,215,136
Messages
6,123,246
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top