Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Lin100
Yak Posting Veteran
70 Posts |
Posted - 2006-09-10 : 13:20:56
|
Access 2003 and SQL 2000 ServerThe Update query generate no error message, but it did not update the SQL table either.'''''''''''''''''''''''''''''''''''''''''Private Sub Submit_Click() Dim cmd As ADODB.Command Dim cnThisConnect As ADODB.Connection Set cnThisConnect = CurrentProject.Connection Set cmd = New ADODB.Command Set cmd.ActiveConnection = CurrentProject.Connection If Verify_Old_Password = True Then If New_Password = Confirm_Password Then cmd.CommandText = "UPDATE User_Account " _ & "SET P = '" & Forms!Password_Dialog!Confirm_Password & "' " _ & " WHERE Name = '" & Forms!Main_Switch_Board!Current_User & "';" 'The code below did not cause an error, but it did 'not update the password in the table User_Account cmd.Execute , , adAsyncExecute 'The code below cause an error 'Run-Time error '-2147467259'. Operation must use an updateable query 'cmd.Execute , , adCmdText 'DOES NOT WORK MsgBox "The new password has been updated to the system.", _ vbInformation, "New password." <--- This message did pop up DoCmd.Close Else If IsNull(New_Password) = True Or IsNull(Confirm_Password) = True Then MsgBox "Incorrect password. Either the new or the confirm password are blank. Enter the password for both.", _ vbExclamation, "Incorrect password." End If End If Else MsgBox "Incorrect password. Please enter the old password again.", _ vbExclamation, "Incorrect password." End IfEnd Sub |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-10 : 17:56:51
|
Have you tried getting the contents of the cmd.CommandText and running it directly in Query Analyser?Also, you might find it easier to do a direct execution of the query against the connection object:sql = "UPDATE...."CurrentProject.Connection.Execute sql If you want to keep with using the Command object, try setting the CommandType to the stored procedure type before executing (can't remember the enum name off-hand)HTH,Tim |
 |
|
Lin100
Yak Posting Veteran
70 Posts |
Posted - 2006-09-10 : 19:34:52
|
Hi timmy. I used the code CurrentProject.Connection.Execute sql, and it gives me an error. 'Run-Time error '-2147467259'. Operation must use an updateable query |
 |
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-09-10 : 19:38:29
|
Have you tried running the query in QA? |
 |
|
|
|
|
|
|