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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applying a command button to an option group 1

Status
Not open for further replies.

AQHA

Technical User
Apr 5, 2007
7
US
I have an option group with 5 choices. I want a command button to print a report based on the selection. How is this done?
 
Have a look at the DoCmd.OpenReport method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
In the OnClick event of the command button, you can place a Select Case statement such as: (The 1,2,3,4,5 are the postions of the options in the option group)

Private Sub Command9_Click()
Dim WClause, RName
Select Case [RptFrame]
Case 1
WClause = "[DateOfLease] Between #" & _
Me![Start] & "# AND #" & _
Me![End] & "#"
RName = "Sales_And_Leasing_Rpt"
Case 2
WClause = "[FinalSettlementDate]is null"
RName = "Sales_Pending_Report"
Case 3
WClause = "[FinalSettlementDate] Between #" & _
Me![Start] & "# AND #" & _
Me![End] & "#"
RName = "Sales_Report"
Case 4
WClause = "[FinalSettlementDate] Between #" & _
Me![Start] & "# AND #" & _
Me![End] & "#"
RName = "Sales_Report_Monthly"
Case 5
WClause = "[ReviewedDate] Between #" & _
Me![Start] & "# AND #" & _
Me![End] & "#"
RName = "Reag_Review_Date_Count_Rpt"
End Select
DoCmd.OpenReport _
ReportName:=RName, _
WhereCondition:=WClause, _
view:=Me![OutputTo]
End Sub
 
Thanks PHV & fneily-----problem solved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top