MsgBox: only if macro succeeds

J

John Hipskind

My macro imports Excel files, and works fine (thanks to
help from you guys).

I would like users to know the process was successful by
including a MsgBox at the end of the macro.

However, if the user tampers with the templates, or
repeats a number in the table's key field, Access will
stop the process with an error message--but after
cancelling out of that message, the macro will continue
and my MsgBox informs users that the data was imported,
when in fact it was not.

How can I have MsgBox test for an Access error message,
and display "Data successfully imported" only if the
macro is successful?

Thanks.

John
 
D

Dan Artuso

Hi,
I beleive you have to resort to VBA for this.
Macros do not have error trapping so there's no way
to trap an error and inform your user that the whole process
failed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top