S
Sara
I have an Access 2000 db with loads of queries and
reports. I would like the user to be able to run a module
that will run the right query, and put 2 reports to the
screen in Print Preview.
I wrote the VBA module and I can get it to work if I click
on one of the two (identical) run buttons on the toolbar
in VBA editor. The problem is that I want to put the
module in a Group, and have the user click "Run" or double-
click the module to run it. But the "Run" button is
grayed-out.
I've been through help and web searches and read VBA for
Dummies (I guess I'm whatever is lower than a dummy!), and
I can't figure out how to get this to work. The module
works, but has to be run from the code window. And then
when both reports are on the screen, control goes back to
the Module window. I want the user to Run (double click)
a module from the "Group" in MS Access, and never see the
code, just see the 2 reports in print preview.
I'm so close, and can't figure out this last step.
(Module:
Option Compare Database
Option Explicit
' M_Front_End_Report
'
Private Function M__Front_End_Report()
On Error GoTo M__Front_End_Report_Err
Dim strMsg As String, strInput As String
' Initialize string.
strMsg = "Now enter parameters for the Over-Short
Quarterly Report "
' Suppress all messages
DoCmd.SetWarnings False
' Run Query to put data in the table; requries
Parameters for Year and Quarter
DoCmd.OpenQuery "MTQ_StoreOSas Pct of CoOS and
COSales", acNormal, acReadOnly
' Run Front End Report
DoCmd.OpenReport "R_Front End Report by Quarter",
acPreview, "", ""
' Run Qtrly Over/Short Report
' Tell user reason for entering parameters again
MsgBox strMsg
DoCmd.OpenReport "R_OverShort for Qtr by Week",
acPreview, "", ""
' Reset messages
DoCmd.SetWarnings True
M__Front_End_Report_Exit:
Exit Function
THANKS!!!
reports. I would like the user to be able to run a module
that will run the right query, and put 2 reports to the
screen in Print Preview.
I wrote the VBA module and I can get it to work if I click
on one of the two (identical) run buttons on the toolbar
in VBA editor. The problem is that I want to put the
module in a Group, and have the user click "Run" or double-
click the module to run it. But the "Run" button is
grayed-out.
I've been through help and web searches and read VBA for
Dummies (I guess I'm whatever is lower than a dummy!), and
I can't figure out how to get this to work. The module
works, but has to be run from the code window. And then
when both reports are on the screen, control goes back to
the Module window. I want the user to Run (double click)
a module from the "Group" in MS Access, and never see the
code, just see the 2 reports in print preview.
I'm so close, and can't figure out this last step.
(Module:
Option Compare Database
Option Explicit
' M_Front_End_Report
'
Private Function M__Front_End_Report()
On Error GoTo M__Front_End_Report_Err
Dim strMsg As String, strInput As String
' Initialize string.
strMsg = "Now enter parameters for the Over-Short
Quarterly Report "
' Suppress all messages
DoCmd.SetWarnings False
' Run Query to put data in the table; requries
Parameters for Year and Quarter
DoCmd.OpenQuery "MTQ_StoreOSas Pct of CoOS and
COSales", acNormal, acReadOnly
' Run Front End Report
DoCmd.OpenReport "R_Front End Report by Quarter",
acPreview, "", ""
' Run Qtrly Over/Short Report
' Tell user reason for entering parameters again
MsgBox strMsg
DoCmd.OpenReport "R_OverShort for Qtr by Week",
acPreview, "", ""
' Reset messages
DoCmd.SetWarnings True
M__Front_End_Report_Exit:
Exit Function
THANKS!!!