I have a access 2002 application with several forms. I open those forms by clicking the continue button one after another by order. Once the next form is open, the previous form will be hidden. If the next form unload, the previous form will be shown. In the last form, there are several buttons to perform some different actions. The following is part of code in the cmd_click sub. Some time, it error out with the error message the command or action setwarnings isn t available now. When I click the debug, it points to DoCmd.SetWarnings False. Sometimes it works without any problem but sometimes it errors out. What's the reason? I searched online and found many similar posts but can not find a straight answer to know what's the real problem and how to resolve the problem.
Thank you very much!
Dim sqlupdate As String
sqlupdate = "update data set "
sqlupdate = sqlupdate & "reference= 1"
sqlupdate = sqlupdate & " where projectno = '" & projectno & "' And "
sqlupdate = sqlupdate & " company = '" & company & "' And "
sqlupdate = sqlupdate & " test = '" & Test & "' And "
sqlupdate = sqlupdate & " extension = '" & extension & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL (sqlupdate)
DoCmd.SetWarnings True
Thank you very much!
Dim sqlupdate As String
sqlupdate = "update data set "
sqlupdate = sqlupdate & "reference= 1"
sqlupdate = sqlupdate & " where projectno = '" & projectno & "' And "
sqlupdate = sqlupdate & " company = '" & company & "' And "
sqlupdate = sqlupdate & " test = '" & Test & "' And "
sqlupdate = sqlupdate & " extension = '" & extension & "'"
DoCmd.SetWarnings False
DoCmd.RunSQL (sqlupdate)
DoCmd.SetWarnings True