Jason,
I'm not sure this is the way you'll want to go, but I have a method that I use all the time.
I base the combo on a UNION query that includes a dummy record for " -All- ", so that it sorts to the top. In the first column, which is hidden, this usually has a value of zero--it's got to be a value that won't be used by any value in the table your getting records from.
Here's the sql for one of these:
SELECT tblUnit.UnitName AS Unit, tblUnit.UnitID AS ID FROM tblUnit WHERE (((tblUnit.UnitID)>1) AND ((tblUnit.Retired)=False)) UNION SELECT " -ALL- " AS Unit, 0 AS ID FROM tblUnit ORDER BY Unit;
There's a button on the form to generate the report. In the code for that, branch with an if statement to see whether or not you'll use the criterion from that combo box. Here's an example of how that code might work:
Private Sub btnGenerate_Click()
If Me.cmbUnit = 0 Then
Call DoCmd.OpenReport(strRpt, acViewPreview)
Else
Call DoCmd.OpenReport("rptDiscrepByUnit", acViewPreview, , "UnitID = " & Me.cmbUnit)
End If
End Sub
Jeremy
==
Jeremy Wallace
AlphaBet City Dataworks
Affordable Development, Professionally Done
Please post in the appropriate forum with a descriptive subject; code and SQL, if referenced; and expected results. See thread181-473997 for more pointers.