Hi,
I have a table with field EmployeeID. On a form (bound to the table) I have a combo box to lookup EmployeeID (from another table) and a command button to preview a report. I want to filter the report by the ID in the combo box.
With the code below I keep getting an input box asking for a parameter value popping up when I click the preview button, it shows the ID from the combo box.
How do I stop the input box and have the parameter passed directly to the DoCmd command line.
__________________________________________________ ___________
Private Sub cbEmployeeName_Click()
strName = Me!cbEmployeeName.Column(0)
End Sub
__________________________________________________ ___________
Private Sub coPreviewWOReport_Click()
On Error GoTo Err_coPreviewWOReport_Click
Dim stDocName As String
stDocName = "WOListing"
strFilter = "[EmployeeID]=" & strName
DoCmd.OpenReport stDocName, acPreview, , strFilter
Exit_coPreviewWOReport_Click:
Exit Sub
Err_coPreviewWOReport_Click:
MsgBox Err.Description
Resume Exit_coPreviewWOReport_Click
End Sub