Subform

G

Guest

I'm looking for help on the following issue:

I have a form with a subform. When I open the main form i want the subform
to remain hidden. I ony want the subform to be visible when i make a change
to textbox 1. When textbox 2 is active I want the subform to be hidden.


Thanks for any help
 
A

Al Camp

ram,
Use the AfterUpdate event of Textbox1...
frmYourSubFormName.Visible = True

I'm not sure what you mean by "active" in...
When textbox 2 is active
You could use the OnEnter event of Textbox2, but it's up to
you to choose the appropriate event to key the "hide" code.
frmYourSubFormName.Visible = False
 
J

John Vinson

I'm looking for help on the following issue:

I have a form with a subform. When I open the main form i want the subform
to remain hidden. I ony want the subform to be visible when i make a change
to textbox 1. When textbox 2 is active I want the subform to be hidden.


Thanks for any help

You can set the Visible property of the subform control to False in
the Form's Open event (and in the form properties), and then to True
in the first textbox's AfterUpdate event.

I have no idea what you mean by "when textbox 2 is active" - when it
has the focus? when it's modified? or what?

John W. Vinson[MVP]
 
G

Guest

Hi Al,

I receive the following error message when textbox1 has the focus
Access can't find the form subform1

I use the following code:

Forms![subform1].Visible = True

Do you have any idea why it can't find this form?
Subform1 is the name I have for this form.

Thanks fro your help
 
A

Al Camp

I wrote...This is correct to refer to a subform from the main form.

Why did you add "Forms!" to the reference?
Your code refers to the main form, skips the main form name, and then
addresses the sub.
If you want to use the "full" address in your code...
Forms!frmYourMainFormName!frmSubForm1.Visible = True
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

ram said:
Hi Al,

I receive the following error message when textbox1 has the focus
Access can't find the form subform1

I use the following code:

Forms![subform1].Visible = True

Do you have any idea why it can't find this form?
Subform1 is the name I have for this form.

Thanks fro your help




Al Camp said:
ram,
Use the AfterUpdate event of Textbox1...
frmYourSubFormName.Visible = True

I'm not sure what you mean by "active" in...
You could use the OnEnter event of Textbox2, but it's up to
you to choose the appropriate event to key the "hide" code.
frmYourSubFormName.Visible = False
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
G

Guest

Thanks Al

Al Camp said:
I wrote...This is correct to refer to a subform from the main form.

Why did you add "Forms!" to the reference?
Your code refers to the main form, skips the main form name, and then
addresses the sub.
If you want to use the "full" address in your code...
Forms!frmYourMainFormName!frmSubForm1.Visible = True
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

ram said:
Hi Al,

I receive the following error message when textbox1 has the focus
Access can't find the form subform1

I use the following code:

Forms![subform1].Visible = True

Do you have any idea why it can't find this form?
Subform1 is the name I have for this form.

Thanks fro your help




Al Camp said:
ram,
Use the AfterUpdate event of Textbox1...
frmYourSubFormName.Visible = True

I'm not sure what you mean by "active" in...
When textbox 2 is active
You could use the OnEnter event of Textbox2, but it's up to
you to choose the appropriate event to key the "hide" code.
frmYourSubFormName.Visible = False
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


I'm looking for help on the following issue:

I have a form with a subform. When I open the main form i want the
subform
to remain hidden. I ony want the subform to be visible when i make a
change
to textbox 1. When textbox 2 is active I want the subform to be hidden.


Thanks for any help
 

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