I don't know whether this questions fits here or not, but if it doesn't let me know.
I'm very much beginner in programming, and I've started it in vb.net for a project I've to do for my college work.

To add the data of a user from a form, when I fill the values for the fields in the user's form and click the button, I'm having a "Syntax Error in INSERT INTO statement" error for adding the entries in the access database.
I want to be able to insert the data into the UsersTable and LoginTable.

My program originally was like this:

usersform_program_screenshot.png

After looking at a solution on this website (https://www.daniweb.com/programming/software-development/threads/489939/inserting-data-into-two-separate-tables-in-an-access-database), I changed my code to this:

usersform_programchanged_screenshot.png

But it still doesn't work and gives the error:

Untitled.png

The UsersTable has a UserID column (primary key) with datatype 'AutoNumber' and all the other columns as seen in the query in the image above in the database, and the table is completely empty.
The LoginTable has the same UserID column with datatype 'Number' and Username, Password columns. The table is also completely empty.
The UsersTable is linked in relationships with LoginTable through the UserID, Username and Password columns for both.
Please help me!

Re: "Syntax Error in INSERT INTO Statement" - VB.Net and Access 80 80

I suggest that instead of posting a low-res, blurry, hard to read screen cap of your code you copy/paste your actual code. Some people may actually go to the trouble of testing code locally and being able to copy the code from here ensures that they are testing the same code that you are running.

As a rule, when I get an error the first thing I do is examine the actual sql command string.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.