Re: Display Alerts in Access
i think you will need to get the information you want to display and use a message box
pete
Re: Display Alerts in Access
No, I don't want it to display any messages/alerts...
Vince
Re: Display Alerts in Access
Quote:
and I do want to display this message.
sorry i got it wrong
just put in error handling with resume next
pete
Re: Display Alerts in Access
Wow, I should of tried that... thanks for your help .
VO
Re: Display Alerts in Access
It didn't work... when i step through the code, the alert occurs before the code goes to the error handle. The alert is the following: "Microsoft is unable to apend all the data to the table. Do you want to proceed?"
Re: Display Alerts in Access
before that position, put in a line
on error goto errorhandle
at the end of the sub, on the line before End Sub add a few lines like
VB Code:
exit sub ' so normally code will not go past
errorhandle: ' label to go to
if err.number = xxxx then resume next , where xxxx is the number for the
'error you are getting and resume next mean go back to the line after the error
' here you would have conditions for other errors
End Sub
to go back to other errors not being processed by this error handler put
on error goto 0
pete
Re: Display Alerts in Access
I put an "on error goto errorhandle" line in my code before the error occurs. However, it still give me the same problem. The alert message is displayed BEFORE the program goes to the error handler. Is there no way to turn alerts off in Access?
VO
Re: Display Alerts in Access
There's an choice in the Options menu on the toolbar of Access to turn on/off warnings. FWIW, I think that in some cases that overrides normal error handling.
The problem with turming off warnings is that will affect your whole app. It's probably possible to turn it off & back on through menubar commands, but I don't know the code for that offhand.
But do you really want to turn it off? It would be a lot better to handle the error in some way.
Re: Display Alerts in Access
Since this is a Insert or AddNew record error from the data being incomplete or incorrect, I dont think you can turn off that
level of an error. Its best to fix the error.
Re: Display Alerts in Access
I agree that the error should be fixed. However, just for everyone's information, DoCmd.SetWarnings will enable or disable warnings in Access...
Thanks for everyone's help,
VO
Re: Display Alerts in Access
It can also be accessed from the app object.
VB Code:
Application.DisplayAlerts = False 'Turn them off
'Do something that will invoke an error message
Application.DisplayAlerts = True 'Turn it back on.