Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2005

Tip: Looking for answers? Try searching our database.

Identifying a popup's "root" form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Aaron G - 28 Nov 2005 19:16 GMT
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
Klatuu - 28 Nov 2005 20:27 GMT
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

> Using Access 2003
>
[quoted text clipped - 13 lines]
> Aaron G
>  Philadelphia, PA
John Vinson - 28 Nov 2005 21:21 GMT
>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]    
Aaron G - 28 Nov 2005 21:32 GMT
That will do it.  Thanks to both of you.

Aaron G
Philadelphia, PA

> >So, what is the best way to identify the root form of a popup via VB?  
>
[quoted text clipped - 3 lines]
>
>                   John W. Vinson[MVP]    
Dirk Goldgar - 28 Nov 2005 23:09 GMT
>> 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.

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.

Signature

Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.