Add Cases

G

Guest

Is it possible to add cases to the following code?
The code currently just shows a report. I am trying to add two check boxes
(box1 and box2) which would display different reports, All Cases, OPEN cases
and CLOSED cases - based on which check box (if any) the user picks.

Example:
Case "ALL"
If Me.box1 false and Me.box2 false Then
DoCmd.OpenReport "r_ALLcases", acViewPreview

Case "OpenCases"
If Me.box1 True and Me.box2 false Then
DoCmd.OpenReport "r_OPENcases", acViewPreview

Case "ClosedCases"
If Me.box1 False and Me.box2 True Then
DoCmd.OpenReport "r_CLOSEDcases", acViewPreview

///////////

Dim stDocName As String
stRecords = "E"

stDocName = "r_EPO_Report"
If IsNull(Me.txtStartDate) Or IsNull(Me.txtEndDate) Then
MsgBox "Please make sure you entered a start and end date."
Exit Sub
Else
DoCmd.OpenReport stDocName, acPreview
End If
 
G

Guest

Instead of check boxes, use an option box. The option box value can be
tested in your case statements. I hope that answers your question. If you
are using a combo or list box with the values "All", etc. then you can use
the case statements as you show them. You can nest select/case so you can
have something like this:

Select combocontrol.value
case "All"
select optionbox.value
case 1
print firstreport
case 2
print otherreport
end select
case "opencases"
etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top