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!

Continuous form and hiding fields

Status
Not open for further replies.

Legends77

Technical User
Jan 18, 2009
57
US
I have a continuous form that I have been asked to modify. On the form, there is a drop down box "Material" where they can select a variety of items such as Sand / Cement / Waste / Pallets / Customer. I used the below which works but it causes issues if the first record is "Sand" but the next is "Customer". I need to find a way to limit the code the the current record. so if that record is "Sand" only the permitted fields will be visible and the same goes if the record is "Customer".
If Me.Material = "Sand" Then
Me.Hours.Visible = False
Me.Drops.Visible = False
Me.Dollars.Visible = False
Me.Tons.Visible = True
ElseIf Me.Material = "Cement" Then
Me.Hours.Visible = False
Me.Drops.Visible = False
Me.Dollars.Visible = False
Me.Tons.Visible = True
ElseIf Me.Material = "Waste" Then
Me.Hours.Visible = False
Me.Drops.Visible = False
Me.Dollars.Visible = False
Me.Tons.Visible = True
ElseIf Me.Material = "Pallets" Then
Me.Hours.Visible = True
Me.Drops.Visible = True
Me.Dollars.Visible = False
Me.Tons.Visible = False
ElseIf Me.Material = "Customer" Then
Me.Hours.Visible = False
Me.Drops.Visible = False
Me.Dollars.Visible = True
Me.Tons.Visible = False
End If
 
About the only way to set different property values of controls on a continuous form is through conditional formatting. You can't show or hide controls in individual records in a continuous form.

I question the table structure. It seems you could have a column that stores whether the record is for Hours, Drops, Dollars, or Tons and then have a single field for the value. I could be way off base with this.


Duane
Hook'D on Access
MS Access MVP
 
Unfortunately it cannot be done unless you build and unbound form.

You can do this with conditional formatting. Format the backcolor and textcolor the same as the background to make it appear invisible. Set the enable to false in the oncurrent event for those fields. Unfortunately you can only do this for 4 conditions (3 + default). I see at least 5.
 
Think I will leave as is and let them discover this may not be the way to go and deal with it then.
but thanks for the suggestios... from what I can tell there are more important items on their "list" that are more function vs "appearance" related that should be higher priority.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top