Cancel append if 0 records

radshar

Registered User.
Local time
Yesterday, 23:17
Joined
Aug 5, 2016
Messages
32
Hi,

I have the following code that runs:
Code:
Private Sub Recurrence_review_BUTTON_Exit(Cancel As Integer)
DoCmd.OpenQuery "Delete the appended records to Recurrent rc from cumul"
DoCmd.OpenQuery "Daily Review of new/oustanding", acViewNormal, acEdit
End Sub

In the event there are 0 records to append, how can I cancel both commands? and perhaps a message box after the cancel?

thanks,
 
There no need to cancel if 0 records. Nothing will add. Why do work to cancel it, if it does nothing?
 
I need to cancel because it still runs the append and delete. The process continues as if there were records, it says there are 0 records, but I still get all the prompts related to those queries.

There no need to cancel if 0 records. Nothing will add. Why do work to cancel it, if it does nothing?
 
Where are the records?

It appears you are moving records around to indicate some aspect of their status. This is an improper way to manage data.

BTW, those query names are horrible. Best avoid spaces and special characters in all object names.
 
Code:
Private Sub Recurrence_review_BUTTON_Exit(Cancel As Integer)
DoCmd.SetWarnings False
DoCmd.OpenQuery "Delete the appended records to Recurrent rc from cumul"
DoCmd.OpenQuery "Daily Review of new/oustanding", acViewNormal, acEdit
DoCmd.SetWarnings True
End Sub

This will get rid of all the prompts, the fact that it tries and sees there is nothing to do shouldn't be a problem.
 

Users who are viewing this thread

Back
Top Bottom