Need to have a button open (make visible?) a subform?

J

Jaxbirchmuck

I am new to Access, using Access 2002 set on 2000 version.
I looked through the archives but could not find this:
I have a form with various data fields and three buttons.
I need the buttons to do three different things.
The first button saves the form and I need it to add a value to the record
for future filtering.

The second button saves the form and I need it to add a value to the record
that is different than above for filtering, say the first one adds an "A" to
the table and the second a "C" to the table in a column.
I think I can figure that out from searching on here.

The third button I need it to open, or make visable a subform where I can add
additional data fields. I can create the subform via the subform wizard but I
am lost on how to make the sub form only 'appear' when the third button is
pressed. It doesn't matter if it is a popup or on the other form (I have left
space for it).

Most of the code I have used I got from here or out of a book, this has me
stumped.
Thanks in advance for helping a newbie!
 
J

John Spencer

Add the subform control to your form.
Click on the subform control and set its visible property to NO

In the buttons click code, use a statement like the following.
Me.NameOfsubFormControl.Visible = True

If you need to navigate to another record on the main form and want to
hide the subform control, then in the current event of the main form you
will need
Me.NameOfsubFormControl.Visible = False

WARNING: That will error if the subform control still has the focus, so
you may need code to move the focus to a specific control on the main form.
Me.SomeOtherControl.SetFocus


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

Jaxbirchmuck via AccessMonster.com

Simply perfect and very easy to follow your instructions.

Thank You Mr. Spencer!
 

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