Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

if then subform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Papa Jonah - 14 May 2008 19:07 GMT
I have a form with a set of radio buttons.  I want the radio buttons (two
options) to define which of two subforms appear.
I suspect I need to select the option group and put something in for after
update, but I have no idea what.
Then I suspect I put both subforms on the form and set their visible setting
to no.
Some how after update of the radiobutton one subform or the other will have
the visible setting turned to yes.

Do I have the right idea?  How do I implement it?

TIA

Papp
Damon Heron - 14 May 2008 21:31 GMT
Yes, use an option group with two buttons.  The option group click event
(here called Frame1) can do everything you want.

Private Sub Frame1_Click()
If Frame1.value= 1 then
me!your1stsubformName.Form.Visible= true
me!your2ndsubformName.Form.Visible= false
else
me!your1stsubformName.Form.Visible= false
me!your2ndsubformName.Form.Visible= true
End if

End Sub

Damon

>I have a form with a set of radio buttons.  I want the radio buttons (two
> options) to define which of two subforms appear.
[quoted text clipped - 12 lines]
>
> Papp
Papa Jonah - 15 May 2008 03:29 GMT
Damon,
That worked great.  However, I know need the chosen subform to stay selected
within each record as I select the individual records.  For example, record 1
may have selected subform 1 and records 2-5 have subform 2.

How can I do that.

> Yes, use an option group with two buttons.  The option group click event
> (here called Frame1) can do everything you want.
[quoted text clipped - 28 lines]
> >
> > Papp
Damon Heron - 15 May 2008 14:54 GMT
It sounds like something in the record is determining the choice of
subforms, rather than the user.  That is a different matter.
What distinquishes each record?  The main form's current event would be a
good place to set the subform based on some
criteria found on the current record.  Look at the current event in help.
something like:
if "my control on mainform=somevalue" then make this subform visible, else
make the other subform visible.

Damon

> Damon,
> That worked great.  However, I know need the chosen subform to stay
[quoted text clipped - 39 lines]
>> >
>> > Papp
Papa Jonah - 16 May 2008 05:26 GMT
> It sounds like something in the record is determining the choice of
> subforms, rather than the user.  That is a different matter.
[quoted text clipped - 52 lines]
>
> The numeric value associated with the selected radiobutton gets stored in a field called reviewassessment.  So when the user initially selects the button, the number gets stored in a table.  I suspect, based on this number, the subform is chosen to be visible or not.
I can't figure out how to do that.  In Access 2007 I don't see a current
record option.
TIA
Damon Heron - 16 May 2008 16:45 GMT
With your main form in design view, right click to select properties.  On
the event tab, the first selection is On Current.  click on the "..." which
will allow you to enter code that executes each time you move to a different
record.  The ReviewAssessment number (from the table) should be on your main
form.  The part I don't get is why you have a button to select the
reviewassessment number. But in any event, the on current event code to
select the subform to view should be somewhat like my previous examples:
If ReviewAssessment= 1 then 'or whatever value it has...
   me!your1stsubformName.Form.Visible= true
   me!your2ndsubformName.Form.Visible= false
else
   me!your1stsubformName.Form.Visible= false
   me!your2ndsubformName.Form.Visible= true
End if

Damon

>> It sounds like something in the record is determining the choice of
>> subforms, rather than the user.  That is a different matter.
[quoted text clipped - 61 lines]
> record option.
> TIA
Papa Jonah - 19 May 2008 15:20 GMT
Thanks Damon.
The part I was missing was the oncurrent for the form rather than the radio
button frame.  
The button is just the radio button on the main form so that through the
user's selection of the radio button, the appropriate subform shows up.

Thanks again.
Papa

> With your main form in design view, right click to select properties.  On
> the event tab, the first selection is On Current.  click on the "..." which
[quoted text clipped - 78 lines]
> > record option.
> > TIA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.