Application.setoption???

  • Thread starter Thread starter Joe_dn
  • Start date Start date
J

Joe_dn

Guest
I have a form that writes data to a table, I have added the following:-

Application.SetOption "Confirm Record Changes", False
Application.SetOption "Confirm Action Queries", False

This means that the user doesnt have to agree to amend the table when updating. Sometimes this update invalidates a primary key and if the wrong option is selected then the whole system goes into debug, is there an option set to stop this from happening??

Basically exit the sub with out the error or the update???
 
You need to add error handling to your code. Look at the code created by the cmdbutton wizard.

Most times it is good to trap the error and display your own custom message.

If you are really sure you can put the following....

Private Sub cmdButtonName_Click()
On Error Resume Next

...your code here

Exit Sub

Dave

PS..

If it is the delete warning that is being displayed, this can be turned off in the database under Tools -> Options -> Edit/Find then Confirm

or you can use

Docmd.SetWarnings False

Docmd.SetWarnings True
 
Can you do the same for a run time error, that is, set an option so it just doesnt display it???
 

Users who are viewing this thread

Back
Top Bottom