I'm trying to filter my report based on a value selected from a list box. This should be fairly straightforward, but I keep getting an error and no data when the report displays.
PROJ_NAME is what I'm trying to filter on the report.
This is my code for the button on the form:
Private Sub REPORT_DISPLAY_Click()
On Error GoTo Err_REPORT_DISPLAY_Click
Dim stDocName As String
Dim strWhere As String
stDocName = "PROJECT REPORT"
strWhere = "[PROJ_NAME] = [FORMS].[SELECT_PROJECT].[PROJECT_LIST]"
DoCmd.OpenReport stDocName, acPreview, WhereCondition:=strWhere
Another option would be to use the Filter property of the report itself. Place some code in the Report_Open event then set the FilterOn property to True and then set the Filter property to the value you want by referencing the combo/list box on the form.
Hope that makes sense. If not reply back and I code throw up some code.