Z
Zilla
HI,
I'm trying filter a report based on a combobox selection. Previously done
fine with a macro, I'm just trying to de-macro my database. But, I cannot get
the "where" condition to do anything! All I get is an empty report.
The sub is attatched to a button on the same form as the combo:
-
Private Sub Command47_Click()
DoCmd.OpenReport "rptTLNew", acViewPreview, , Project_Name =
Forms!frmTLReportCallup!compj
End Sub
-
compj = the combo box with the filter criteria.
frmTLReportCallup = the form with the controls
Project_Name = the field in the query underlying the report
Vba help tells me that this is the proper syntax for a where condition:
[fieldname] = Forms![formname]![controlname on form]. This does not seem to
work. I have tried putting "" around everything, nothing and each individual
section of the condition, with no joy.
I am guessing that the problem is to do with an incorrect !, ", [ etc, but I
cannot see where or more importantly why.
Thanks for looking
I'm trying filter a report based on a combobox selection. Previously done
fine with a macro, I'm just trying to de-macro my database. But, I cannot get
the "where" condition to do anything! All I get is an empty report.
The sub is attatched to a button on the same form as the combo:
-
Private Sub Command47_Click()
DoCmd.OpenReport "rptTLNew", acViewPreview, , Project_Name =
Forms!frmTLReportCallup!compj
End Sub
-
compj = the combo box with the filter criteria.
frmTLReportCallup = the form with the controls
Project_Name = the field in the query underlying the report
Vba help tells me that this is the proper syntax for a where condition:
[fieldname] = Forms![formname]![controlname on form]. This does not seem to
work. I have tried putting "" around everything, nothing and each individual
section of the condition, with no joy.
I am guessing that the problem is to do with an incorrect !, ", [ etc, but I
cannot see where or more importantly why.
Thanks for looking