-
Dear All
This won't work
Code:
cnn.BeginTrans
sSQL = "INSERT INTO tblUsers " _
& "(User_Name, Password, Group) VALUES ('" & txtUserName & "', '" & txtPassword & "', '" & cboGroup & "');"
cnnMIS.Execute sSQL
cnn.CommitTrans
This is what the sSQL string returns
INSERT INTO tblUsers (User_Name, Password, Group) VALUES ('Gary Lowe', 'newpass', 'Admins')
The only other field in the table is an ID field which is an auto number, will this have to be added to the sql string.
The database is access 97 FE = VB6
-
No you should not include the ID if it's an auto numbered field.
What error message do you get?
You use a transaction on a connection object called cnn but you execute the SQL statement on a connection object called cnnMIS, could that be the problem?
Give us some more information and I will be happy to try to answer your question.
Best regards
-
Joacim
The connection objects in the code are all cnnMIS, I was just trying to make it look general.
The error that keeps coming up is:
-2147217900
Syntax error in INSERT INTO statement.
I can't see anything wrong with the SQL though.
-
I believe that VB-SQL is getting confused by your use of "Group" as a field name. Try changing it to something like "GroupName".
-
Thanks Martin
That worked