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

    User Logon (2000)

    Hi,

    I am using the best logon sample that I can find to build my database. Now I would like user name automaticly attach every data that user enter in the database, I can generate productive report. But I don't know how to automatic link the UserID with every data that user entered in the database. For example, in the attached database, John (User) logon the database after he put his user name and password. John starts to enter the data in the service form. I would like every service he enters in the database will automatically have his userID in the userID field.

    Please see the attached database.

    I would really appreciate any help with this issue.

    Regards

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

    Re: User Logon (2000)

    I'm sorry to say so, but this example is not very good. It is very easy to find out the usernames and passwords, and since it relies on a global variable to store the username, it is fragile - the variable will be cleared if an unhandled error occurs.

    You should apply user-level security - see WendellB's tutorial The Secrets of Security.

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: User Logon (2000)

    I have not looked at your database, but if it's one form then setup the USerID in the BeforeUpdate event of the form for a new record.

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

    Re: User Logon (2000)

    Hi Hans,

    Thank you for providing that security information and it really useful and helpful. The reason of using this sample insecurity login example to my database is there

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

    Re: User Logon (2000)

    Sorry if this sounds harsh, but you'll have to decide - you either take security serious, and you implement user-level security, or you don't (which may be perfectly acceptable in many situations, many of my databases aren't secured because it isn't necessary), and forget about silly login dialogs that don't offer any protection whatsoever (you can press Ctrl+F4 to close it).

    In an unsecured database you can still log who creates a record (and if you wish, also who last modified it) without much effort. Put the code from <post:=446,010>post 446,010</post:> in a standard module. Change the USerID field in tblService to a text field (you'll have to delete the relationship with tblUser first). You can use the GetNetUser function, for example in the Before Insert event of frmService:

    Private Sub Form_BeforeInsert(Cancel As Integer)
    Me.UserID = GetNetUser
    End Sub

    (I would either remove or hide the text box bound to UserID, or set its Enabled property to No and its Locked property to Yes. Otherwise, the user can modify the UserID right on the form.

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

    Re: User Logon (2000)

    Hi Hans,

    Thank you for helping. But I did what you said, but it seems not working. Please see the attachment.

    Regards

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

    Re: User Logon (2000)

    You have put the function GetNetUser in a module also called GetNetUser. This confuses Access. Give the module another name, for example basGetNetUser. It should work then.

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

    Re: User Logon (2000)

    Hi Hans,

    Yes, now it works. Thanks a lot.
    Another question: Since we use Novell manger our network, is the GetUser going to get Novell user name or local window account?

    Regards

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

    Re: User Logon (2000)

    I don't use Novell, so I'm not 100% sure, but I think you'll get the Novell username.

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

    Re: User Logon (2000)

    Thanks. I will try it when I get back to work.

    Regards

Posting Permissions

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