Selections based on 2 option groups

Real Wally

Registered User.
Local time
Today, 10:18
Joined
Jan 28, 2003
Messages
107
I have a from with 2 option groups, one is called Companies, the other Areas.
The form also has 2 comboboxes, each controlled by one of the two option boxes.
So far so good, the values change nicely to the selected company and area. One box holds 9 buttons, the other 5 so that's 45 choices all together.

What I'd like to do next is be able to view/print forms and reports based on the values selected.
I cannot figure out how to do that.

At the moment I've got a form with 45 buttons that are each linked to a frm based on a query for the specific combination. I'm not pleased at all with the result. The form is a mess and I'm sure there is a much more clever solution to select and print using the option groups.

Who's willing to help?

Thanks,

Wally
 
Hi everybody.
I've posted this a few days ago but haven't had a reply yet. Maybe my problem is just too simple for the experts to be interested but I really haven't got a clue how to solve this puzzle.

Can someone please guide me a litttle here?

Thanks,

Wally
 
Not really sure what you're trying to do, what is the purpose of the option groups
 
Create a function in the General Section of the form....

Option Compare Database
Dim intPrintMode As Integer ' 0 = print, 2=preview
Dim strReportName As String
------------------------------
Function GetReport()

Dim strCriteriaCo As String
Dim strCriteriaArea As String

strReportName ="MyReportName"
'Note if using diff reports depending on selection
'then add strReportName ="MyReportName" in 'Case is =' line

Select Case grpCompanies

Case Is = 1
strCriteriaCo ="[CompanyName] = 'Name of Co selected'"

etc etc for all Company options

End Select

Select Case grpAreas

Case Is = 1
strCriteriaArea ="[AreaName] = 'Name of Area selected'"

etc et for all Area options

End Select

DoCmd.OpenReport strReportName, intPrintMode, , strCriteriaCo & " AND " & strCriteriaArea

End Function

Add TWO print buttons, one for preview and the other for Print

On prev button OnClick put...

intPrintMode = 2
GetReport

On print button OnClick put...

intPrintMode = 0
GetReport
 

Users who are viewing this thread

Back
Top Bottom