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