Hi. You'd need to convert your macro's steps to the equivalent VBA code to do this, as you cannot perform the checks needed at each step from within a macro.
In VBA code you have full control of the way you check the status value and can prevent the other steps from executing relatively straightforwardly. A skeleton of what I mean is listed below:
- Public Function fRunUpdates() as Boolean
-
'Returns TRUE if all actions run to completion
-
'FALSE if not
-
DoCmd.SetWarnings False
-
DoCmd.OpenQuery "qryYourUpdate1"
-
if YourStatusValue = 0 then goto exit_function
-
DoCmd.OpenQuery "qryYourUpdate2"
-
if YourStatusValue = 0 then goto exit_function
-
DoCmd.OpenQuery "qryYourUpdate3"
-
if YourStatusValue = 0 then goto exit_function
-
DoCmd.OpenQuery "qryYourUpdate4"
-
if YourStatusValue = 0 then goto exit_function
-
...
-
DoCmd.OpenQuery "qryYourUpdate9"
-
if YourStatusValue = 0 then goto exit_function
-
DoCmd.SetWarnings True
-
fRunUpdates = True
-
Exit Function
-
exit_function:
-
Docmd.SetWarnings True
-
fRunUpdates = False
-
End Function
All this does is to test the status value after each action query is run. If the status value is not as expected then the function is exited cleanly returning False as its output value to indicate that it did not run to completion.
I do not know what your status value is or how you would access it, so I've put a dummy test in the skeleton. You'd have to work out how to test the value as appropriate for yourself.
-Stewart