Passing a string to subform's Filter property while opening main form

  • Thread starter Thread starter April Marano
  • Start date Start date
A

April Marano

I'm using Access 97 to create a form that a user can use to enter search
criteria. He will then click on a button (cmdOpenDatabase) thereby opening
another form whose underlying query is filtered using criteria derived from
the first form.

I understand that I can create an event handler for the cmdOpenDatabase
button that will create a WHERE string that I can use as one of the
DoCmd.OpenForm parameters. The problem is, I want to pass that string to
the Filter property of one of the soon-to-be-opened form's SUBforms (not the
main form).

How can this be done?

Much thanks in advance!

April
 
Probably the most straightforward approach is to store the WHERE
string in a Public variable in a Module before you open the main Form
and grab it in the Open Event of the subForm. I am not sure that you
can rely on the main Form's OpenArgs being available to the subForm
when it is opening (though someone may be able to correct me on ths).

I'm using Access 97 to create a form that a user can use to enter search
criteria. He will then click on a button (cmdOpenDatabase) thereby opening
another form whose underlying query is filtered using criteria derived from
the first form.

I understand that I can create an event handler for the cmdOpenDatabase
button that will create a WHERE string that I can use as one of the
DoCmd.OpenForm parameters. The problem is, I want to pass that string to
the Filter property of one of the soon-to-be-opened form's SUBforms (not the
main form).

How can this be done?

Much thanks in advance!

April


Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
Back
Top