Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Options Group to Hide/Show Controls

Status
Not open for further replies.

dreandre

Technical User
Mar 27, 2003
27
US
In my database, I have two separate tables, one for Lease Agencies and one for Vendors.

On my form, I need to enter inventory that has been either purchased or leased. I want to include an Options group with the two options. Based on which option is clicked, I would like to show the related controls and hide the not related controls. For example, if the Lease option is clicked, I would like to hide the purchased controls so that only the Lease controls are visible, and vice-versa.

I'm prepared to work with subfroms or combo boxes to accomplish this, however if there is a third possibility, I would be interested to hear it.

Thanks for you interest!!

Andre
 
try
control.visible = False/True
there are a few ways of doing this

Hope this helps
Hymn
 
Not difficult at all: Use the after update event of the option group frame to test for the group value. Use a simple select case block to set the visible property of the controls as necessary. hth.
 
Using the same logic, I would approach this from the perspective of when creating a new record, reviewing the record and changing the arrangement.

Private sub display_sub ()

Dim intOpt as Interger

intOpt = me.OptValue

select case intOpt

case 1
mySubfrmLease.Visible = False
mySubfrmPurchase.Visible = True

case 2
mySubfrmLease.Visible = True
mySubfrmPurchase.Visible = False

else case
mySubfrmLease.Visible = False
mySubfrmPurchase.Visible = False

end select

Then call the display_sub function for events
- on current
- after update for the option value (but you will have to decide how to handle events if a person switches from lease to purchase and there is existing data for such in the table.)

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top