Cancel append if 0 records (1 Viewer)

radshar

Registered User.
Local time
Today, 09:43
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,
 

Ranman256

Well-known member
Local time
Today, 12:43
Joined
Apr 9, 2015
Messages
4,337
There no need to cancel if 0 records. Nothing will add. Why do work to cancel it, if it does nothing?
 

radshar

Registered User.
Local time
Today, 09:43
Joined
Aug 5, 2016
Messages
32
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?
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 02:43
Joined
Jan 20, 2009
Messages
12,859
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.
 

Tieval

Still Clueless
Local time
Today, 17:43
Joined
Jun 26, 2015
Messages
475
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

Top Bottom