Option group - Op1,Op2,Op3,All

  • Thread starter Thread starter HeatherM
  • Start date Start date
H

HeatherM

I have a report based on a simple query. It is a list of
projects sorted by division name. I want to create a
selection form that will allow the report to run for a
single division or all divisions. I think I want an option
group with buttons for Division1, Division2, Division3 and
All.

How do I do that and refer to the choice in my query?

Thanks,

Heather
 
Heather,
Have an Option Group with 4 buttons.
Code the OptionGroup AfterUpdate event:

Dim strWhere as String
Select Case OptionGroupName
Case is = 1
strWhere = "[Division] = 'Division1'"
Case is = 2
strWhere = "[Division] = 'Division2'"
Case is = 3
strWhere = "[Division] = 'Division3'"
End Select
DoCmd.OpenReport "ReportName", acViewPreview, , strWhere

If the 4th option was clicked, all the records will show.
The above assumes the [Division] field datatype is text, not number.

If the [division] is a number datatype then use
strWhere = "[Division] = 1"
or whatever the actual number is for each.
 
Back
Top