View Single Post
  #5  
Old December 20th, 2006, 04:13 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default SubForm Visibility

Scuba's method will work.
There is another approach I use to allow the main form to load faster.
That is to leave the source object and Link Master Fields and Link Child
fields properties blank and the visible property of the subform control No.

Then in the After Update event of the toggle button:

Dim strSource As String
Dim strMaster As String
Dim strChild As String

If Me.opgMyOption Group = 1 Then
strSource = "frmSomeForm"
strMaster = "SomeMainField"
strChild = "SomeSubField"
Else
strSource = "frmAnotherForm"
strMaster = "SomeOtherMainField"
strChild = "SomeOtherSubField"
End If

With Me.MySubFormControl
.SourceObject = strSource
.LinkMasterFields = strMaster
.LinkChildFields = strChild
.Visible = True
End With

If the subforms are of different sizes, you can include the Height, Width,
Left, and Top properties to position and size the subform the way you need it.

If you want to start fresh with no subform showing for each record, use the
form Current event:

Me.MySubFormControl.Visible = False
Me.

"Julia CHP" wrote:

Hello-

I would like to design a form for data entry which, when a button is
clicked, a specific sub-form is loaded/visible.

I have 2 sub-forms that need to be completed, however I want the user to be
able to toggle between the two.

However, I don't want the user to be able to see the sub-form that they do
not need to use until they are ready to use it.

So- I'd like my toggle button to make either the one form visible, OR the
other form visible, but not both at the same time.

Thanks.