Results 1 to 4 of 4

Thread: custom security

  1. #1
    Join Date
    Sep 2003
    Location
    MN US
    Posts
    313

    Unanswered: custom security

    I'm setting up (or attempting to) basic security using a user/password table.

    Nothing too complex. Something like:

    varPassword = DLookup("[Password]", "tblUser", "[Username] =" _
    & Me!NameBox

    If Me!PasswordBox = varPassword Then blah blah

    Can someone post a routine that checks a table for correct UserID and Password?

    I've attempted this using DLookup. I messed with the syntax for a couple hours and still couldn't get it working.

    I've seen similar posts but can't seem to locate them in the archives.

    Feeling a bit retarded.

    Thanks in advance,

    CP

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Some ADO Code:

    Code:
        SQLString = "SELECT PurchaseOrderAdmin FROM UserBillingSettings WHERE (UserID='" & MyUserID & "');"
        MyRecSet.Open SQLString, MyConnect
        If MyRecSet.BOF = False Then
            MyRecSet.MoveFirst
            IsAdmin = MyRecSet.Fields(0).Value
        End If
        MyRecSet.Close
        
        If Not IsAdmin Then
            MsgBox "You do not have permission to access this interface.", vbCritical, "System Monitor"
            PopulateMyTables = 0
            Exit Function
        End If
    You could do this with 2 DLookups also ... 1 for the userid and 1 for the password ...

  3. #3
    Join Date
    Sep 2003
    Location
    MN US
    Posts
    313
    That'll work. Thank you very much.

    It's not critical, but can you tell me why I would need 2 DLookups? I'm having trouble grasping the logic.

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Originally posted by cpgospi
    That'll work. Thank you very much.

    It's not critical, but can you tell me why I would need 2 DLookups? I'm having trouble grasping the logic.
    A DLookUp returns a single item ...

Posting Permissions

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