What is this code for?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good morning

I inherited a database (... and alll that it involves! :-) ). I came across the following code in a form_current event (this is the only line of code in the event except for the error handler. Can someone explain what it does? Is it necessary

If ChildFormIsOpen() Then FilterChildFor

Thank you for the help

Daniel
 
Daniel,

The code appears to be calling:

First, a user-defined function named ChildFormIsOpen() . This
function will return a True or False

Second, a user-defined sub named FilterChildForm

If the return value of ChildFormIsOpen() is True, the code will then run the
sub named FilterChildForm. You'll have to search your code to find out
what FilterChildForm does.

--

Cheryl Fischer, MVP Microsoft Access



Daniel P said:
Good morning!

I inherited a database (... and alll that it involves! :-) ). I came
across the following code in a form_current event (this is the only line of
code in the event except for the error handler. Can someone explain what it
does? Is it necessary?
 
Daniel P said:
Good morning!

I inherited a database (... and alll that it involves! :-) ). I came
across the following code in a form_current event (this is the only
line of code in the event except for the error handler. Can someone
explain what it does? Is it necessary?

If ChildFormIsOpen() Then FilterChildForm

Thank you for the help,

Daniel

I believe I recognize this code as that generated by the form wizard
when you tell it to create "linked forms", having selected fields from
two related tables. Then it creates a "parent form" with a toggle
button on it to open or close a second "child form" -- not a subform on
the parent form -- and inserts the code you've posted in the parent form
to ensure that the child form is always filtered to show the "child"
records that are related to the current parent record. There's some
other code inserted in both the parent form and the child form to
support this arrangement, if I recall corrrectly.
 
Back
Top