Trying to filter report from a combo box selection

David Ball

Registered User.
Local time
Tomorrow, 01:45
Joined
Aug 9, 2010
Messages
230
Hi,

I am trying to open and filter a Report from a Command button on a Form. I select a value from a combo box, Combo3, and press the command button, Command6. The field that I want to filter on is called JCARD. The values in the combo box are all of the format JCD-0220-01.
The VBA for my On Click event is:
Private Sub Command6_Click()
DoCmd.OpenReport "rptJCActivities", acViewPreview, , "JCARD= " & Me.Combo3
End Sub

When I select a value from the combo box and press the command button I get an Enter Parameter Value box open up with the “JCD” displayed on it. If I enter a value into the parameter box and press OK I get a 3071 error saying the expression is too complex. If I leave the box empty and press OK the report opens but is empty.
If I type JCD-0012-01 directly into the query criteria row the query works fine.
What do I need to change?
Thanks very much
Dave
 
Code:
DoCmd.OpenReport "rptJCActivities", acViewPreview, , "JCARD= '" & Me.Combo3 & "'"
 
Thanks very much, Galaxiom. Works well!
 

Users who are viewing this thread

Back
Top Bottom