On a form I am using I have a drop-down field that is used to control the filtering of a sub form. There is also a button on the main form that exports the sub form's source query with:
If the user has set a filter criteria I would like the query to reflect that. I tried doing that using a WHERE statement:
WHERE xtbRphAITNew.CellNum Like Forms!frmAITTotals.CellNum;
My problem with that is when there is no value in the form filter I get a blank query. What is the best way to go about this?
Code:
DoCmd.OpenQuery "qryJoinXtb2", acViewNormal
DoCmd.OutputTo acOutputQuery, "qryJoinXtb2", acFormatXLS, "AIT Totals.xls", True
If the user has set a filter criteria I would like the query to reflect that. I tried doing that using a WHERE statement:
WHERE xtbRphAITNew.CellNum Like Forms!frmAITTotals.CellNum;
My problem with that is when there is no value in the form filter I get a blank query. What is the best way to go about this?