Visible Properties

S

Swansea

I have a form field called Orders and another field called Supplier. How do I
make the Supplier field Invisible except when selected Orders are entered
into the Orders Field?
 
D

Dirk Goldgar

Swansea said:
I have a form field called Orders and another field called Supplier.
How do I make the Supplier field Invisible except when selected
Orders are entered into the Orders Field?

You can't easily do this on a continuous form, though there are tricks
you can use to get around the problem. If your form is in single-form
view, however, you can use code in the form's Current event and the
AfterUpdate event of the Orders control to set the visibility of the
Supplier field. For (simple) example:

Private Sub SetSupplierVisibility()

Select Case Me!Orders
Case "a", "b", "c"
Me!Supplier.Visible = True
Case Else
Me!Supplier.Visible = False
End Select

End Sub

Private Sub Form_Current()
SetSupplierVisibility
End Sub

Private Sub Orders_AfterUpdate()
SetSupplierVisibility
End Sub
 
S

Swansea

Thanks

Dirk Goldgar said:
You can't easily do this on a continuous form, though there are tricks
you can use to get around the problem. If your form is in single-form
view, however, you can use code in the form's Current event and the
AfterUpdate event of the Orders control to set the visibility of the
Supplier field. For (simple) example:

Private Sub SetSupplierVisibility()

Select Case Me!Orders
Case "a", "b", "c"
Me!Supplier.Visible = True
Case Else
Me!Supplier.Visible = False
End Select

End Sub

Private Sub Form_Current()
SetSupplierVisibility
End Sub

Private Sub Orders_AfterUpdate()
SetSupplierVisibility
End Sub


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Top