originalxavier
Programmer
Hey everyone,
I am having some difficulty hiding controls on a form. I have a form with a subform in it. It is a "secure" database requiring a logon and the shift bypass key is disabled so no one can enter the database without authentication. However, I want to make sure that no one can gain access to the forms who is not logged in so I have an "If" statement saying that if there is no user logged in hide all controls.
When this code is run I get a "run time error 424" "object required" and it points to "ctlCurrent" which is " = nothing". I am wondering if I forgot to reference a library necessary for this?... Any help would be appreciated.
Xavier
----------------------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning"
Rick Cook
----------------------------------------
I am having some difficulty hiding controls on a form. I have a form with a subform in it. It is a "secure" database requiring a logon and the shift bypass key is disabled so no one can enter the database without authentication. However, I want to make sure that no one can gain access to the forms who is not logged in so I have an "If" statement saying that if there is no user logged in hide all controls.
Code:
Private Sub TestHideCTR_Click()
Dim ctlCurrent As Control
'Check to see if a user is logged in.
If lngMyEmpID > 0 Then
'Perform no action
Else
'If there is no user logged in, hide all controls
For Each ctlCurrent In frmCurrent.Controls
ctlCurrent.Visible = False
Next ctlCurrent
End If
End Sub
When this code is run I get a "run time error 424" "object required" and it points to "ctlCurrent" which is " = nothing". I am wondering if I forgot to reference a library necessary for this?... Any help would be appreciated.
Xavier
----------------------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning"
Rick Cook
----------------------------------------