W
WannaBeVBQueen
I'm having problems(SYNTAX error messages or wrong text added to database
table) when I use the following UPDATE and INSERT INTO SQL statements in my
VBA code, why is this?
"INSERT INTO LogIn (UserID,PW) VALUES=(txtNewUserName.text,CurrentUser)"
(or)
"UPDATE LogIn SET PW = '<txtNewPassword.text>' WHERE UserID =
'<CurrentUser>' "
All I want is my code to write the values from the textbox control
(txtNewUserName) and/or global variable (CurrentUser) into the specified
Access database table fields.
My connection to Access Database is done using ADO Object and everything
work fine, I just can't get it to Execute properly:
nwConStr2 = "Provider=microsoft.jet.OLEDB.4.0;" & "Data
Source=C:\Passwords.mdb"
nwCon2.ConnectionString = nwConStr2
nwCon2.Mode = adModeReadWrite
nwCon2.CursorLocation = adUseClient
nwCon2.Open
nwSql2 = "INSERT INTO LogIn (UserID,PW)
VALUES=(txtNewUserName.text,CurrentUser)"
nwCon2.Execute nwSql2, , adExecuteNoRecords
table) when I use the following UPDATE and INSERT INTO SQL statements in my
VBA code, why is this?
"INSERT INTO LogIn (UserID,PW) VALUES=(txtNewUserName.text,CurrentUser)"
(or)
"UPDATE LogIn SET PW = '<txtNewPassword.text>' WHERE UserID =
'<CurrentUser>' "
All I want is my code to write the values from the textbox control
(txtNewUserName) and/or global variable (CurrentUser) into the specified
Access database table fields.
My connection to Access Database is done using ADO Object and everything
work fine, I just can't get it to Execute properly:
nwConStr2 = "Provider=microsoft.jet.OLEDB.4.0;" & "Data
Source=C:\Passwords.mdb"
nwCon2.ConnectionString = nwConStr2
nwCon2.Mode = adModeReadWrite
nwCon2.CursorLocation = adUseClient
nwCon2.Open
nwSql2 = "INSERT INTO LogIn (UserID,PW)
VALUES=(txtNewUserName.text,CurrentUser)"
nwCon2.Execute nwSql2, , adExecuteNoRecords