Use AddAllToList as Criteria

Jolted_Chicken

Registered User.
Local time
Today, 18:41
Joined
Nov 7, 2002
Messages
15
In a combo box, [Forms]![frmMonthlyReport].[ComobBranch]

it is used to select the criteria for a query.

There are seven to choose from each used for a report.

Currently, the user has to select each item from the combo box then open to report.

Now, I need to be able to select 'all' from the combo box so all seven reports comes out at ones.

I've already added '(All)' in the combo box using a union query but I dont know what I need to change in the query criteria so that all seven reports get generated all in one go.

any takers?
 
Jolted Chicken?? Ah well, no accounting for taste. I am a vegge' myself. However, I digress.

I had a simimilar problem and solved it this way.
If you only have seven reports, I would use a list box instead of a combo box. Set the Multi Select property to simple. Create a command button and place this code behind the On Click Event.

Dim vntIndex As Variant
Dim strValue As String

For Each vntIndex In ListBoxName.ItemsSelected
strValue = ListBoxName.ItemData(vntIndex)
DoCmd.OpenReport strValue, acViewNormal
Next

David
 
Thanks for the quick reply,

The combo box that I currently use is for selecting a criteria on a query which is called by ONE report.

I need to call that one report seven times, each selecting a different item in the box. I wanted to select an "All" from the box so I dont have to select the 7 choices individually.

The method you've shown me works if there are seven different report names to call.

Any more takers?
 
Remove the All option from the combo box and try this code (using the correct combo box name and report name) from the Click Event of a command button on the form:-

------------------------------
Private Sub Command0_Click()
Dim i As Integer

For i = 0 To Me.ComobBranch.ListCount - 1
Me.ComobBranch = Me.ComobBranch.Column(0, i)
DoCmd.OpenReport "reportName"
Next i
End Sub
------------------------------

The code selects each option in the combo box and sends the report to the printer.

Note. You can't use acViewPreview in the OpenReport method, as the code will run too fast for you to preview the first report and close it.

Hope it helps.
 

Users who are viewing this thread

Back
Top Bottom