Results 1 to 12 of 12
  1. #1
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164

    Username and password login and timestamp to the record entry's

    Hi,

    I am building a Staff holiday database and I would like to have the user login and when the user books the holiday the table detects who is logged in and auto create a record entry and time of the user.



    How do I do this?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    does your database have login method you designed? i.e. each person has a login and password stored in a table in your database that you're using to validate the user?

    If so on a successful login you can do something like:

    1. Create a table tblLoginAttempts, put two fields on the table, USERID (assuming you're using an autonumber as a primary key for your user table) and DATEADDED set the default value of the DATEADDED field to now()
    2. if you just want to store successful attempts to log in add to your 'successful' part of code

    Code:
    dim db as database
    dim iUserID as long
    
    set db = currentdb
    iUserID = dlookup("[UserID]", "tblLogins", "[UserName] = " & username)
    db.execute ("INSERT INTO tblLoginAttempts (UserID) VALUES (" & iuserid & ")")
    set db = nothing
    the DATEADDED field will be automatically populated with the date/time the person's ID was added to the table.

    This assumes your USER table is named tblLogins
    Your table tblLogins has an autonumber primary key and the USERNAME is unique

  3. #3
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Thanks for the quick reply and help!

    Here is my layout

  4. #4
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Front startup screen
    Attached Thumbnails Attached Thumbnails uploadfromtaptalk1425929551636.jpg  

  5. #5
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Successful login
    Attached Thumbnails Attached Thumbnails uploadfromtaptalk1425929676369.jpg  

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    is there a follow up question? The only thing different is that you are allowing the users to select their name so instead of having to use dlookup to find their employee ID you can just adopt the value of the combo box assuming you are using an autonumber as the primary key of the table and it is also the bound column of your combo box.

  7. #7
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Button macro 1 pt1
    Attached Thumbnails Attached Thumbnails uploadfromtaptalk1425931168215.jpg  

  8. #8
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Button macro pt2
    Attached Thumbnails Attached Thumbnails uploadfromtaptalk1425931209180.jpg  

  9. #9
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Users table

    Thanks again for the help [emoji4]
    Attached Thumbnails Attached Thumbnails uploadfromtaptalk1425931278038.jpg  

  10. #10
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I don't use macros so I can't help you there but you are checking a dlookup value in the get userID section, that's where you'd want to append a record to a table but I have no idea how you'd do that in a macro or if it's even possible unless you had an append query written using the same methodology I described above, then just run the query on a successful login.

  11. #11
    djspod is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Mar 2015
    Posts
    164
    Many thanks again.
    Don't know enough about VBA yet or to make a query or how to add to the existing macro but I get your logic.

    Any tips or Web links to a code I could copy or tutorials.

    If need be I can scrap my login firm and start a fresh and create tables to match the code

  12. #12
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if you look at where you force a message box with the 'password correct', you can add another condition there and run your append query in the macro I would think.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Username and password
    By AzizSader in forum Forms
    Replies: 3
    Last Post: 12-20-2013, 11:36 PM
  2. Username and passwod login using Form
    By Tom1 in forum Programming
    Replies: 4
    Last Post: 07-04-2012, 12:29 PM
  3. Replies: 3
    Last Post: 06-22-2012, 04:19 PM
  4. username&password
    By metokushika in forum Access
    Replies: 1
    Last Post: 11-16-2011, 03:13 AM
  5. Recording UserName Login
    By Moonsitter53 in forum Access
    Replies: 1
    Last Post: 03-18-2011, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums