Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why won't warnings turn off

Status
Not open for further replies.

Savil

Programmer
Apr 28, 2003
333
EU
Hi all
Acc 97
On the beforeupdate event for a form the code checks for form completeness, no problem. If the form is not complete then the line "cancel = true" is actioned. You then get the message that you have canceled an event blah blah which is very annoying so I changed the cancel line to

docmd.setwarnings false
cancel = true
docmd.setwarnings true

The message still comes up. How can I get rid of it?
 
Perhaps something like this.. I place in a form open event
Public gcCurrentNode As MSComctlLib.node
Public gcOriginalOptionState As Boolean
'Set Confirm Changes to True - Used for Deletes
gcOriginalOptionState = Application.GetOption("Confirm Record Changes")
Application.SetOption "Confirm Record Changes", True

Then on Unload, I reset the option using the global variable gcOriginalOptionState which I created...
'Reset Option for MS Access to Original Setting
Application.SetOption "Confirm Record Changes", gcOriginalOptionState

htwh???


Steve Medvid
"IT Consultant & Web Master"

Chester County, PA Residents
Please Show Your Support...
 
Thanks for your reply but this is not applicable to Access 97
 
I believe that the setwarnings method does not turn off the message you are referring to. I think that only turns off messages such as "you are about to paste 42 records to table xyz. Do you want to continue?" The message you are trying to get rid of has to be handled separately.

Have you tried using an Error Handler to trap that error message?

First, do a test with a message box to show what the error number is, then edit the error handler to just do nothing if it produces the specific error you are getting..

I am fairly certain this will work. If you try it, let me know if it did.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top