parameter query problem

G

Guest

I have a form to open a report. I am having 2 problems:

1) I have a combo box the row source reads:
"Region A";1;"Region B";2;"Region C";3;"Regions 1 & 2";1 or 2;"All
Regions";1 or 2 or 3


This parameter is fed to the report query.

However, I can not get the query to work for the choices that have more
than one region.
I have tried also tried, to get all results:

*
and

""

Thank you.







error 2501 in my report's open event

If Err.Number <> 2501 Then
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
End If

However, I still get the error!

What can it be?

Thanks
 
G

Guest

Hi Duane,

I appreciate your input. I have looked at Allen Browne's page on
multi-select listboxes, but i am wondering if there is a way to fix this
without using a multi-select? I only have like 5 options, and would love for
it to work with a simple DD.

Thanks.
 
G

Guest

You can't feed an expression like "1 or 2" into a query criteria from a list
box or any other control.

I try to remove all dynamic criteria from report record sources. Consider
changing your Row Source to
"Region A";"1";"Region B";"2";"Region C";"3";"Regions 1 & 2";"1, 2";"All
Regions";"1 , 2 , 3"
Make sure the bound column is the 2nd.
I created a similar control on a form in Northwind in an attempt to filter a
report against the ShipVia field of the Orders table. The code I used was:
Private Sub cmdShipViaReport_Click()
On Error GoTo Err_cmdShipViaReport_Click

Dim stDocName As String
Dim strWhere As String
strWhere = "[ShipVia] IN (" & Me.cboShipVia & ")"
stDocName = "rptShipVia"
DoCmd.OpenReport stDocName, acPreview, , strWhere

Exit_cmdShipViaReport_Click:
Exit Sub

Err_cmdShipViaReport_Click:
MsgBox Err.Description
Resume Exit_cmdShipViaReport_Click

End Sub
 

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

Similar Threads

Dcount the values 0
Sorting and Grouping 2
Parameter Report Question 2
On Format report errors 1
Counting Regions 1
OpenReport error handling 2
Copying Subreports 2
Choose "ALL" in Combo Box 4

Top