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!

Disabling a Subform

Status
Not open for further replies.

txteacher

Technical User
Jul 5, 2006
11
US
In Access 2000, I am creating a form that can be accessed by everyone in the company. The subform though I only want the admin to access to it. I was wondering if there was a way to disable the subform until the admin enters his/her user id. If this is possible can anyone help with an example of the code or point me in the right direction? Thanks
 
Something like this?
Code:
Private Sub cmdEnableSubForm_Click()
    Dim strUserName, strPassword As String
    strUserName = Me.txtUserName
    strPassword = Me.txtPassword
    If strUserName = "Administrator" And strPassword = "adminpassword" Then
        Me.frmSubForm.Enabled = True
    Else
        Me.frmSubForm.Enabled = False
    End If
End Sub

'=================================================
Private Sub Form_Open(Cancel As Integer)
Me.frmSubForm.Enabled = False
End Sub

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top