Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Password to protect a tab contol using a text box.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mikeinohio - 20 May 2008 05:17 GMT
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?
Klatuu - 20 May 2008 15:23 GMT
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?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.