click to hide click to unhide

A

alex

Hello all,

Is there code that you can put behind a cmd button that will hide/
unhide a control?

E.g.,
Click once = hide
Click again = unhide
Click again = hide
....

I think I could create a check box and base the visible property of
the control off the value of the checkbox, but I was curious if a cmd
button could function in this regard.

alex
 
J

Jeff Boyce

Alex

Me!YourControl.Visible = Not Me!YourControl.Visible

You can add that to the command button's Click event procedure...

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

alex

Alex

    Me!YourControl.Visible = Not Me!YourControl.Visible

You can add that to the command button's Click event procedure...

Regards

Jeff Boyce
Microsoft Office/Access MVP










- Show quoted text -

Jeff,

It worked perfectly!
While I've got your ear...can I dynamically change the size of my pop
up form based on if that control is visible or not.

For example (keep in mind the control that hidden/unhidden is at the
bottom of the form):
When it's visible the form is 5" long.
When it's not visible the form shrinks to 4".
When it's visible again, the form grows to accomodate the control.

I thought the form's auto resize property would take care of this, but
it doesn't.

alex
 
J

Jeff Boyce

Give yourself some better odds of getting a response ... respost your (new)
question as a new post.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Alex

Me!YourControl.Visible = Not Me!YourControl.Visible

You can add that to the command button's Click event procedure...

Regards

Jeff Boyce
Microsoft Office/Access MVP










- Show quoted text -

Jeff,

It worked perfectly!
While I've got your ear...can I dynamically change the size of my pop
up form based on if that control is visible or not.

For example (keep in mind the control that hidden/unhidden is at the
bottom of the form):
When it's visible the form is 5" long.
When it's not visible the form shrinks to 4".
When it's visible again, the form grows to accomodate the control.

I thought the form's auto resize property would take care of this, but
it doesn't.

alex
 
J

John Spencer

You can only resize the form if you move or shrink the control at the
same time you hide it. Just because the control is not visible does not
mean the form can shrink, the control still occupies the space on the form.

Once you have shrunk or repositioned the control, you can resize the
form. When you want to make the control visible again, you will have to
grow the form and then reposition or grow the control and then make it
visible.



'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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