If then Visible Controls on Forms

ccocom

Registered User.
Local time
Today, 10:41
Joined
Nov 15, 2002
Messages
27
I am trying to make certain controls visible on a form for both "on current" and "after update" conditions. I started with this:

Private Sub Form_Current()
If Item = "Monitor" Or Item = "Printer" Or Item = "Telephone" Or Item = "Scanner" Or Item = "Workstation" Then
SerialNumber.Visible = True
Else
SerialNumber.Visible = False
End If
End Sub

This worked great. I then added this:

Private Sub Form_Current()
If Item = "Monitor" Or Item = "Printer" Or Item = "Telephone" Or Item = "Scanner" Or Item = "Workstation" Then
SerialNumber.Visible = True
Else
SerialNumber.Visible = False
End If
If Item = "Monitor" Then
MonitorSpecsID.Visible = True
Else
MonitorSpecsID.Visible = False
End If
End Sub

in an effort to make another field visible under a different condition. I received an error requesting an object. Not sure what to do next. Any ideas?
 
Please specify which line the error is on. I'm guessing that you have a mis-spell. Using Rich's suggestion of Me. would at least bring up the control names and ensure you are referencing a valid control on the form.
 
Thanks. I hadn't renamed the control to match the control source name. A rookie mistake.
 
Thanks. I hadn't renamed the control to match the control source name. A rookie mistake.
 

Users who are viewing this thread

Back
Top Bottom