Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Which form opened another one.

Status
Not open for further replies.

James79

Programmer
Oct 25, 2001
15
0
0
AU
I want to be able to determine which form has opened another one. For example, if you have a calendar form with a simple calendar control in it, and this is opened from 5 different locations. When the calendar is closed it is meant to insert the date into the form that opened it. How can I tell in code which form opened the calendar. Is there another way besides global variables, or the .isloaded property of a form.
 
In the module of the second form, set up a variable and pass the name of the calling form to the variable. Set this variable in the On Open event of the form.

When closing the second form (Or whenever you need to update the original form), use the variable value to update the correct form.

HTH

Lightning
 
Hi!

Use the OpenArgs in the OpenForm method:

DoCmd.OpenForm "YourCalendarForm", , , , , , Me.Name

This will pass the form name to the calendar form and you can reference the name passed in the calendar form using Me.OpenArgs.

hth Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top