I have a database that is being used to house data for Mergefields in a Word doc, among other things. The document is in Word because it is about 16 pages long, but only needs the data for about 12 fields. However, the doc has 2 versions, one for the state of TX and one for everyone else.
What I have is a button that runs a macro that has a MkTblQuery to create the table for the TX doc, and a MkTblQuery to create the table for everyone else's doc. Then I have FollowHyperlink "TXtable" and FollowHyperlink "Othertable". However, if one or both of the tables have no data in them, I want the FollowHyperlink part to be skipped and a MsgBox to come up saying "No Data in TXtable", etc.
I have searched the forum, but all I see out there is how to have the MsgBox come up OnNoData for Reports in Access.
Is there a way to do this? I tried a few things with the CancelEvent function, but haven't been able to get it to work. I'm probably just doing it wrong.
DoCmd.RunMacro "McrPrintVendorPcktsALL"
If DCount("*", "TblVendorPcktPrint") = 0 Then DoCmd.CancelEvent
FollowHyperlink "\\cinfile01\gafri\GDC\GDC Tech\GA Plan Operations Projects\Plan Document Automation\Vendor Packet\Vendor packet 3-22-8merged.doc"
I also tried an IIF statement, but it doesn't like the \\ and other things in the path for the word doc.
I think I am out of my depth here. Any help would be appreciated.
What I have is a button that runs a macro that has a MkTblQuery to create the table for the TX doc, and a MkTblQuery to create the table for everyone else's doc. Then I have FollowHyperlink "TXtable" and FollowHyperlink "Othertable". However, if one or both of the tables have no data in them, I want the FollowHyperlink part to be skipped and a MsgBox to come up saying "No Data in TXtable", etc.
I have searched the forum, but all I see out there is how to have the MsgBox come up OnNoData for Reports in Access.
Is there a way to do this? I tried a few things with the CancelEvent function, but haven't been able to get it to work. I'm probably just doing it wrong.
DoCmd.RunMacro "McrPrintVendorPcktsALL"
If DCount("*", "TblVendorPcktPrint") = 0 Then DoCmd.CancelEvent
FollowHyperlink "\\cinfile01\gafri\GDC\GDC Tech\GA Plan Operations Projects\Plan Document Automation\Vendor Packet\Vendor packet 3-22-8merged.doc"
I also tried an IIF statement, but it doesn't like the \\ and other things in the path for the word doc.
I think I am out of my depth here. Any help would be appreciated.