Identifying a popup's "root" form

A

Aaron G

Using Access 2003

I have a popup that I access from several different forms. When a change is
made to this popup and it's closed, I would like it to requery the root form
it was opened from (which contains some of the data).

I know how to do this by simply naming the forms and giving them a requery
command, however, I don't know a way to identify the root form. If I could
do this in code, it would clean up the script and get rid of some errors (ie.
an error telling me a certain form isn't open).

So, what is the best way to identify the root form of a popup via VB?

TIA

Aaron G
Philadelphia, PA
 
K

Klatuu

If what you are asking is how do I know what form opened the popup, then you
could pass the name of the opening form in the OpenARgs argument of the
OpenForm method. Then in the popup, you will know which form open it:

txtWhoOpenedMe = Me.OpenArgs
 
J

John Vinson

So, what is the best way to identify the root form of a popup via VB?

About the only way I can think of would be to pass the calling form's
Name in the OpenArgs argument of the OpenForm event. In general, a
form doesn't keep any record of how or whence it was opened.

John W. Vinson[MVP]
 
D

Dirk Goldgar

John Vinson said:
About the only way I can think of would be to pass the calling form's
Name in the OpenArgs argument of the OpenForm event. In general, a
form doesn't keep any record of how or whence it was opened.

Here's an alternative: in the popup form's Open event,
Screen.ActiveForm is still the form that had the focus before the popup
was opened. I can imagine how this might fail, though, if some other
form's Timer event fires between the "root" form's call to
DoCmd.OpenForm and the popup form's checking of Screen.ActiveForm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top