Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Skipping Over A Report to Be Printed if no results

Status
Not open for further replies.

NYFashionToGo

Technical User
Jan 16, 2007
76
US
I have some code in an access module that I run from Excel.

It basically gets my items ready for shipping, Printing shipping labels and sales receipts.... Due to the nature of the way I need to print out shipping Labels. I had broken down the reports By = United States <> United States for printing.

Is there a way I can disable the report from printing if There are no results to print a report. The International doesnt happen every day, and I always get a blank sheet printing out..... How do I skip over it....

I tried to iscolate the part of the code below by creating large space between to show where the reports print from..

Option Compare Database

'------------------------------------------------------------
' Import_Sales_and_Payments_Info_Macro
'
'------------------------------------------------------------
Function Import_Sales_and_Payments_Info_Macro()


DoCmd.OpenQuery "Delete Orders Query", acViewNormal, acEdit
DoCmd.OpenQuery "DeleteOrderSummary Query", acViewNormal, acEdit
' Imports Customers
DoCmd.TransferText acImportDelim, "Customers Import Specification", "Customers", "C:\Documents and Settings\Chris\My Documents\NYFashionToGo\ProcessingFiles\AccessImportprocessing\Customers.txt", True, ""
' Imports Orders
DoCmd.TransferText acImportDelim, "Orders Import Specification", "Orders", "C:\Documents and Settings\Chris\My Documents\NYFashionToGo\ProcessingFiles\AccessImportProcessing\Orders.txt", True, ""
' Imports Orders Summaries
DoCmd.TransferText acImportDelim, "OrderSummary Import Specification", "OrderSummary", "C:\Documents and Settings\Chris\My Documents\NYFashionToGo\ProcessingFiles\AccessImportProcessing\OrderSummary.txt", True, ""
' Imports PayPal DownLoad
DoCmd.TransferText acImportDelim, "PayPalDownload Import Specification", "PayPalDownload", "C:\Documents and Settings\Chris\My Documents\NYFashionToGo\ProcessingFiles\AccessImportProcessing\PayPalDownload.txt", True, ""
' Imports updated Feedback Info
DoCmd.TransferText acImportDelim, "UpdateFeedBack Import Specification", "UpdateFeedBack", "C:\Documents and Settings\Chris\My Documents\NYFashionToGo\ProcessingFiles\AccessImportProcessing\UpdateFeedBack.txt", True, ""
' Imports PayPals Echeck For Updates to Mark as Cleared
DoCmd.TransferText acImportDelim, "ECheckUpdate Import Specification", "ECheckUpdate", "C:\Documents and Settings\Chris\My Documents\NYFashionToGo\ProcessingFiles\AccessImportProcessing\ECheckUpdate.txt", True, ""
' Updates Echecks From Pending To Cleared
DoCmd.OpenQuery "UpdateEcheckStatus", acViewNormal, acEdit
' Updates Paid Items Via Paypal and Marks Paid
DoCmd.OpenQuery "Update Mark Items As Paid", acViewNormal, acEdit
' ReturnQueryStep1
DoCmd.OpenQuery "ReturnRefundStep1Query", acViewNormal, acEdit
' ReturnQueryStep2
DoCmd.OpenQuery "ReturnRefundStep2Query", acViewNormal, acEdit
' ReturnQueryStep3
DoCmd.OpenQuery "ReturnRefundStep3Query", acViewNormal, acEdit
' ReturnQueryStep4
DoCmd.OpenQuery "ReturnRefundStep4Query", acViewNormal, acEdit
' Exports CSV Files For Shipping Labels
DoCmd.RunMacro "1 Output Shipping Labels Priority", , ""











DoCmd.OpenReport "Sales Receipt", acPrint, , "[Country]='United States'"
DoCmd.OpenReport "Sales Receipt", acPrint, , "[Country]<>'United States'"













Import_Sales_and_Payments_Info_Macro1_Exit:
Exit Function

Import_Sales_and_Payments_Info_Macro1_Err:
MsgBox Error$
Resume Import_Sales_and_Payments_Info_Macro1_Exit

End Function
 
Have you looked at the No Data property of the report in Access?
 
You can create a macro in Access. It'll have two actions - msgbox and cancelevent.
So, in the first Action row put MsgBox and in the Action Arguments pane place a message.
In the second Action row, select the CancelEvent action.
Save and name the macro.

Then on the On No Data event of the report, place the macro name.
 
Thank You, I Got it to work using this method..... So much I do not know still about this program, Thanks for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top