Control visible only when activated

J

Jan Il

Hi all - Access 2002K

I have a form with a label in the footer. The label is to show the name of
the previous form which opened the current form. How might I call the name
of the previous form into that control, so that when the user is finished
with the current form, they can click the label and return to the previous
form.

The trick to this is, this form can be opened from more that one source
form, so the method for entering the name of the previous form will have to
be generic, or, the name of whichever form just opened the target form.

I'm not sure if this should be done from the form properties, or from the
control itself, but, since it will be a generic method of naming each
related form, it would seem to be from the control properties.

If this is possible, I would truly appreciate any suggestions, or perhaps a
help file that might address such a function.

Jan :)
 
K

Ken Snell

Carry the name of the calling form in the OpenArgs argument of the OpenForm
command. Write that value into the label's Tag property in the form's OnLoad
event. Then, in the label's OnClick event, read the Tag string and get back
the name of the form.
 
D

Dan Artuso

Hi,
This code will give you the name of the calling form *provided* the command
button that
opens your form is not in a subform.

Screen.PreviousControl.Parent.Name

If you have some buttons in subforms, you'll probably have to explicitly
pass the form name
in the OpenArgs argument of the OpenForm method, then check OpenArgs in the
Load event of
the form.

HTH
Dan Artuso, MVP
 
J

Jan Il

Hi Ken!
Carry the name of the calling form in the OpenArgs argument of the OpenForm
command. Write that value into the label's Tag property in the form's OnLoad
event. Then, in the label's OnClick event, read the Tag string and get back
the name of the form.

Thank you very much, I'll give this a try and see how I do. I really
appreciate your help.

Jan :)
 
J

Jan Il

Hi Dan!

"> Hi,
This code will give you the name of the calling form *provided* the command
button that
opens your form is not in a subform.

Screen.PreviousControl.Parent.Name

If you have some buttons in subforms, you'll probably have to explicitly
pass the form name
in the OpenArgs argument of the OpenForm method, then check OpenArgs in the
Load event of
the form.

I'll take a go at this and see if I can get it working. Thank you for your
time and help, I appreciate it very much.

Jan :)
 

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