Make Subform Invisible using Form

G

Guest

I have many subforms on a form and I am using clicks on my main form to set
the visible property for each subform individually. I can click on one
button on my form and the subform shows up fine. Click on another button and
I make one subform invisible and another one visible. I have no need for a
link between the form and subform. This seems to work fine. However, when I
make one subform visible and click on the subform and thus change the focus I
am then unable to use the button on the form to make the subform invisible
again. It is as if the focus changes to the subform and I don't know how to
make it where I can make the subform invisible again. I have looked at
previous postings but cannot find this specific problem anywhere. Thank you
for your help.
 
A

Arvin Meyer

The focus should shift to whatever you click. Try setting the subform height
to 0 instead of making it visible, then setting it back to it's height with
the same button (air code):

Sub cmdWhatever_Click(Cancel As Integer)
If mySubform = 0" Then
mySubform = 2"
Else
mySubform = 0"
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
G

Guest

Hi,
I have multiple subforms overlaid and set the visible property based on the
cmd button they click on. I just put a cmd button on my main form that
resets the subforms visible property of whatever has the focus back to false.
One other way you could do it is attach code to the OnClick event that would
check the visible property and toggle it each time you click.
Hope this helps!

Renee
 

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