Don't keep the password in the control, put it in a table.
Use the After Update event of the password control to validate the entered
password. If the correct password is entered, enable the tab control:
Private Sub txtpwordcrtl_AfterUpdate()
If IsNull(DLookup("PassWord","tblPwd", "PassWord = """ & Me.txtpwordcrtl
& _
"""")) Then
MsgBox "Incorrect Passworkd"
Else
Me.TabCtlPatInfo.Enabled = True
End If
End Sub

Signature
Dave Hargis, Microsoft Access MVP
> I would like to know how could i use a text box called "txtpwordcrtl" to
> enter a password that would enable a tab control called "TabCtlPatInfo". I
> dont want to controp just one tab on the control but the whole control
> itself, and also how could a make a form to change the password in case an
> employee is terminated?
mikeinohio - 20 May 2008 20:25 GMT
I put in a table i alreay had set up and the code you gave me didnt not work
and i ahd to make some educated adjustments and this is the codethat i ended
up with to make all the error messages go away,
Private Sub txtpwordcrtl_AfterUpdate()
' User asked to submit password to view information
If IsNull(DLookup("PatCrtl", "tblPwds", "PatCrtl = """ &
Me.txtpwordcrtl)) Then
MsgBox "Incorrect Password"
Else
Me.TabCtlPatInfo.Enabled = True
End If
End Sub
and when i tested it i got a error message that said:
Runtime Error '3075':
Snytax error in string in query expression 'PatCrtl = "test'
did i miss something somewhere?
> Don't keep the password in the control, put it in a table.
> Use the After Update event of the password control to validate the entered
[quoted text clipped - 16 lines]
> > itself, and also how could a make a form to change the password in case an
> > employee is terminated?
Klatuu - 20 May 2008 21:52 GMT
This line is incorrect:
If IsNull(DLookup("PatCrtl", "tblPwds", "PatCrtl = """ &
Me.txtpwordcrtl)) Then
Should be:
If IsNull(DLookup("PatCrtl", "tblPwds", "PatCrtl = """ &
Me.txtpwordcrtl) & """") Then
Sorry about the errors, but writing code in the message editor, that is easy
to do.

Signature
Dave Hargis, Microsoft Access MVP
> I put in a table i alreay had set up and the code you gave me didnt not work
> and i ahd to make some educated adjustments and this is the codethat i ended
[quoted text clipped - 39 lines]
> > > itself, and also how could a make a form to change the password in case an
> > > employee is terminated?