Results 1 to 2 of 2

Thread: Password in Access Form

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Location
    Ashby, UK
    Posts
    1

    Exclamation

    Hi

    My name is Mat Mannion, and I am a student in Ashby Grammar School in Leicestershire (England) studying A-Level IT. I am currently having a problem with adding a password to my database (USING A FORM, NOT THE MAIN PASSWORD) as the school network prohibits adding of user groups to my database. I am planning to have the switchboard options accessible to everybody, but to edit the database one must have the proper authorisation password.

    I have a form ready set up, with a password field and an OK button which opens when the Edit Database button is pressed from the main switchboard.

    I would like to add some VB Code (ACCESS 97) to the form so that it checks the password entered into the text field and then "validates" it. If the password is correct, it will take the person to the main database screen (IE the one when a new database is started). If the password is incorrect, it will open an error message and return the user to the switchboard.

    Please respond ASAP

    Mat Mannion
    [email protected]

    PS Please email me at [email protected] with the information

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008
    Matt,

    You need to set up a table with user names and passwords.

    After using the form, you need to set it to Nothing, or the internal data will be retuained.

    Code is like

    Code:
    Dim uName as String, uPass As String
    
    uName = Me.txtUName.Text
    uPass = Me.txtUPass. Text
    
    Dim rst as recordset
    rst = OpenDynaset("PassTable")
    rst.Find "UserName = '" & UName & "'"
    
    If .NoMatch Then ' user not found
      MsgBox "Go away"
    Else
      MsgBox "Welcome"
      Open sesame etc...
    End If
    
    etc.
    Cheers,

    Paul
    Not nearly so tired now...

    Haven't been around much so be gentle...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width