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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get the "Visible" property to reset between records in a form 2

Status
Not open for further replies.
May 10, 2001
10
>>>>BACKGROUND<<<<

This is what I have: A Server Inventory database using one form based on one Primary table with several separate tables linked to this for use in combo boxes.

The form contains many text and combo boxes, some tabs, and an OptionGroup with 6 OptionButtons. The Server Name is the Key Index and each record is based on this - with detailed information in the controls.

>>>>DESIRED AFFECT<<<<

The OptionGroup is set up for the user to chose one of six configurations. Three Text boxes should remain hidden until one of the last 4 buttons (not the first 2) are selected. Then they should appear to allow information to be entered. These boxes should stay on the form for that record. When the next record is selected, the three Text boxes should either disappear or appear depending on what buttons are selected (or in the case of a new record, be hidden unless activated).

>>>>THE PROBLEM<<<<

On Record 1, Option Number 3 is selected and the three text boxes appear on the form (this is good). When I move to Record 2, Option Number 2 is selected, but the text boxes remain on the screen (this is bad). If I select Option Number 1, the text boxes disappear (again, as expected). But moving to Record 3 with Option Number 3 selected, the text boxes still are hidden.

>>>>THE PLEA<<<<

I'm sure that I am missing some code in a different section of the form, but cannot figure out what I need to do...
Please help if possible.

Thanks,

Aaron J. Mack


The following is the OptionGroup's AfterUpdate code:

>>>>Begin Code<<<<
Private Sub Support_Box_AfterUpdate()
Select Case Me.Support_Box
Case 0, 1, 2
Me.SP_Prod_ID.Visible = False
Me.SP_Number.Visible = False
Me.Support_Date.Visible = False
Me.SP_Prod_ID.ControlSource = &quot;SP_Prod_ID&quot;
Me.SP_Number.ControlSource = &quot;SP_Number&quot;
Me.Support_Date.ControlSource = &quot;Support_Date&quot;
Case 3, 4
Me.SP_Prod_ID.Visible = True
Me.SP_Number.Visible = True
Me.Support_Date.Visible = True
Me.SP_Prod_ID.ControlSource = &quot;SP_Prod_ID&quot;
Me.SP_Number.ControlSource = &quot;SP_Number&quot;
Me.Support_Date.ControlSource = &quot;Support_Date&quot;
Case 5, 6
Me.SP_Prod_ID.Visible = True
Me.SP_Number.Visible = True
Me.Support_Date.Visible = True
Me.SP_Prod_ID.ControlSource = &quot;R_SP_Prod_ID&quot;
Me.SP_Number.ControlSource = &quot;R_SP_Number&quot;
Me.Support_Date.ControlSource = &quot;R_Support_Date&quot;
End Select
End Sub
>>>>End Code<<<<
 
Hi

Try using some code in the form's OnCurrent event to test for the conditions required, and set the visible property for the text boxes as necessary.

The OnCurrent event will occur every time the focus moves to a record (including new records), so this should give the desired result.

HTH

Lightning

 
You have to use the On Current event to make the controls visible or not as you switch records. Also you might want to experiment with the Tag property testing for a string in the tag (or stuffing/changing the tag on various conditions and then testing) and setting visibility (or any other property) depending on the string there. You could cycle through all controls on the form or just look in specific controls. You can do some pretty clever things with that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top