what I'd do is abandon this approach
create two forms, one acts as the menu /switchboard, contains the parameters, has what ever user interface you wanted to open forms, reports, print reports and so on.
howevr you style that interface is up to you. the other allows users to set the parametrers as they wish, that contains logic to ensure parametrers are sane
in the first form
use the docmd macro to open whatever
.openreport for reports, .openform for forms with appropriate parameters (the whereclause)
immediately before your issue the docmd buld the filter which you then pass as a parameter to .openwhatever
when you build the whereclause, thats where you handle whether someone has entered something for that parameter, if not don't apply that to the whereclause
in the second form allow users to set parameters, but you control their sanity (ie dyas that are valid, products that are valid, product lists and so on. the reason for the separation is that your users have to go into a different form to change things (so they can't claim the reports were different between runs.
your filter building uses sane values, it simplifies the form/report opening bit, separating the docmd from the users changes
you can read or write values between forms / reports
to set a value in another form
forms!myotherform!thatcontrol.value = forms!thisform!thiscontrol.value
to read a value in another form
forms!thisform!thiscontrol.value = forms!thatform!thatcontrol
..replace the this and that whatever with values in your applications
private function BuildWhereClause() as string
buildWHERECluase = "1=1" 'tkae adantage of an SQL dodge, so you will always return a valid where clause
'then go through your parameters
if isnumeric(mynumericcontrol.value) then ' we have a value
BuildWHEREClause = BuildWHEREClause & " AND mynumericcolumn =" & mynumericcontrol.value
if not isnull (mytestcontrol) and len(Mytextcontrol)>1 then ' we have a value
BuildWHEREClause = BuildWHEREClause & " AND mytextcolumn = '" & mytextcontrol.text & "'"
'NOTE text literals MUST be quoted to delimit where the value starts and stops
'say you had a date range
if isdate(mylowerdatevalue) AND isdate(myUpperdatevalue) then
buildwhereclause = buildwhereclause & " AND mydatecolumn BETWEEN #" & format(mylowerdatevalue,"yyyy-mm-dd") & "# AND "format(myupperdatevalue,"yyyy-mm-dd") & "#"
'note date literals must be delimited by the hash symbol #
'when you open the first form, set values to know good'uns
say your reports are usually rin on last weeks data., so set the lowerdatevalue to the start of last week, and the upperdatevalue the end of that week. build what ever logic you need to set initial sane values
I'd rather be riding on the Tiger 800 or the Norton