Results 1 to 9 of 9

Thread: Logon (2000)

  1. #1
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Logon (2000)

    Hi,

    Currently I am using the attached Logon sample in my DB. Now I want the Logon form can automatictly shows last user name in the logon form when user start the DB. I am wondering if there's a way to do this?

    Thanks a lot.

    Regards

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Logon (2000)

    Will each user have an individual copy of the database, or will they use a shared database or frontend?

  3. #3
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Logon (2000)

    Hi Hans,

    Each User have a individual copy of the frontend and link to one backend.

    Thanks

    Regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Logon (2000)

    You can use a table tblLastUser with a field UserID (Number, Long Integer), and a single record. Enter any value in the single record to start off with.

    Put code in the On Load event of the logon form to read the ID of the last user, and put code in the LogUserOn function (in the basLogon module) to store the user ID in the table. See the attached version (I only modified frmLogOn, not frmLogOn2)

  5. #5
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Logon (2000)

    Hi Hans,

    Thank you so much for your help. This is exactly what I want, but I got a small problem. Currently I am using frmLogOn2 in my db and I put the code from frmLogOn1 to frmLogOn2. But the Log on filed only shows the number that store in tblLastUser instead of show user name. Please see the attachment.

    How can I fix it?

    Regards

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Logon (2000)

    The form frmLogon has a combo box that is bound to UserID but that displays the user name, because it has two columns of which the first (with the UserID) is hidden by setting its column width to 0.

    The form frmLogon2 has a text box, so you must put the user name instead of the UserID in it. Change the line

    Me.LogOn = DLookup("UserID", "tblLastUser")

    in the Form_Load procedure of frmLogon2 to

    Me.LogOn = DLookup("UserName", "tblUser", "UserID = " & Nz(DLookup("UserID", "tblLastUser"), 0))

  7. #7
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Logon (2000)

    Thank you so much, Han. It's works. But I do have another question if you don't mind.

    As you know I use frmLogon2 in my DB, I just find out if I type wrong User Name with wrong password. Of course I get an error message. Then I retype the correct user name with right password, I still get the error message. I have to restart the DB in order for me to logon the DB.

    Please help.

    I am really appreciated.

    Regards

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Logon (2000)

    In the LogOn_BeforeUpdate event procedure, you set the variable UsrChk to 1 if the username is not listed in the table. But you don't reset it to another value if the username *is* listed. You should use something like this:

    If counter < 1 Then ' If it is less than 1, either they have spelt it wrong or it does not exist
    UsrChk = 1 ' Dont tell the User their LogOn Name is wrong just yet!
    Else
    UsrChk = 0
    End If

  9. #9
    4 Star Lounger
    Join Date
    Feb 2006
    Posts
    504
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Logon (2000)

    Thank you so much, Hans! It's works.

Posting Permissions

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