A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SubForm Visibility



 
 
Thread Tools Display Modes
  #1  
Old December 20th, 2006, 04:14 PM posted to microsoft.public.access.forms
Julia CHP
external usenet poster
 
Posts: 2
Default SubForm Visibility

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.
  #2  
Old December 20th, 2006, 04:19 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default SubForm Visibility

I use buttons on my main form that does the same thing that I think you want:

For the "on click" event of one button I have:

Private Sub buttonname_Click()

Forms![Main Menu]![Hours Menu].Visible = True
Forms![Main Menu]![Reports Menu].Visible = False

End Sub

For the "on click" event of the other button I have:

Private Sub buttonname_Click()

Forms![Main Menu]![Hours Menu].Visible = True
Forms![Main Menu]![Reports Menu].Visible = False

End Sub

I hope this helps!



"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.

  #3  
Old December 20th, 2006, 04:21 PM posted to microsoft.public.access.forms
scubadiver
external usenet poster
 
Posts: 1,673
Default SubForm Visibility


the "true" and "false" should be the other way round for the second button.

"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.

  #4  
Old December 20th, 2006, 05:01 PM posted to microsoft.public.access.forms
BruceM
external usenet poster
 
Posts: 723
Default SubForm Visibility

You could set the Visible property of one subform control to True and of the
other to False, then use code like this in a command button's Click event:

Me.SubformControl1.Visible = Not Me.SubformControl1.Visible
Me.SubformControl2.Visible = Not Me.SubformControl2.Visible

You could also put one subform on top of the other. Set the visible
property of one to True and the other to False. If SubformControl2 has the
visible property set to False, your command button code could be:

Me.SubformControl2.Visible = Not Me.SubformControl2.Visible

There are other options too, depending on your needs, but the syntax is the
same. Use your actual subform control names, which may be different from
the form names if you created the subforms separately. To see the name of
the subform control, click the very edge of the subform so that small
rectangular "handles" appear at the corners and in the middle of each edge,
then click View Properties. The property sheet that appears will say
Subform/Subreport followed by a name that also appears on the Other tab of
the property sheet. This is the name you need to use in the command button
code.

Or you many find that a tab control (with file tabs like the property sheet)
gives you what you need.

"Julia CHP" wrote in message
...
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.



  #5  
Old December 20th, 2006, 05: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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:35 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.