Results 1 to 15 of 15
  1. #1
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9

    A password validation field upon entry or click

    I'm creating a simple clock in / clock out form. I need for a user to be able to select their name from a combo box, enter their password and click "Clock In"


    Either up on entry of the password, or upon the "Clock In" button click, the password needs to be validated against the password column in tblEmployee. Also, when "Clock In" button is clicked, I need an entry placed in tblTimeClock that records the who is "clocking in" in EmployeeName field/column and the current date AND time in "ClockIn" field/column. It seems like it should be pretty simple, but I can't figure it out.

    Appreciate any help!
    Click image for larger version. 

Name:	Employee.jpg 
Views:	19 
Size:	110.0 KB 
ID:	21585

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    This part should handle the validation of the password.
    Code:
    If IsNull(DLookup("[Password]","[tblEmployee]","[EmployeeName]='" & Forms![myFormName]![ComboName] & "'")) then
        msgbox "Invalid password entered. Please try again."
    exit sub
    end if
    As for the other part, do you want the record appended with the time stamp, or do you want an existing record updated? I'm betting the former.
    However, you are asking for data to be entered into 2 fields but you show 3 in the picture, not counting ID. Is that one an autonumber?
    If you need 3, is the EmployeeID in a form control?

  3. #3
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Quote Originally Posted by Micron View Post
    This part should handle the validation of the password.
    Code:
    If IsNull(DLookup("[Password]","[tblEmployee]","[EmployeeName]='" & Forms![myFormName]![ComboName] & "'")) then
        msgbox "Invalid password entered. Please try again."
    exit sub
    end if
    As for the other part, do you want the record appended with the time stamp, or do you want an existing record updated? I'm betting the former.
    However, you are asking for data to be entered into 2 fields but you show 3 in the picture, not counting ID. Is that one an autonumber?
    If you need 3, is the EmployeeID in a form control?
    The EmployeeID field is not required and will be removed. Just need EmployeeName and Password. But yes, we want to record the in and out so it will need to append the tblTimeClock.
    Finally what I want is a sub-form with "Clock Out" button that only displays after "Clock In" is clicked. This will append the tblTimeClock with EmployeeName and ClockOut field, But first
    things first, lets get the "Clock In" working.

    Thanks for your help!!!

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Before I proceed, be sure you want to drop the id and use only the name. The record id should be unique, but the name cannot be. What will you do if there are two of John A. Smith? Name fields do not make good unique id's. EmplID on the otherhand, can be unique and your table should be set up so that the clock-in goes against a unique identifier, such as EmplID or EmplNO. In the case of two Smiths, you can have jsmith and jasmith, but EmplNo is probably better. Most likely, it's unique enough to be useful for payroll. You cannnot use the ID field in the table if it is an autonumber. If you opt for EmplId as a unique identifier, you need to let me know where it will come from. A form textbox would be good and can be based on the value of the combo box. Should be set by the combo's after update event. It can be hidden (and probably should be).

  5. #5
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Quote Originally Posted by Micron View Post
    Before I proceed, be sure you want to drop the id and use only the name. The record id should be unique, but the name cannot be. What will you do if there are two of John A. Smith? Name fields do not make good unique id's. EmplID on the otherhand, can be unique and your table should be set up so that the clock-in goes against a unique identifier, such as EmplID or EmplNO. In the case of two Smiths, you can have jsmith and jasmith, but EmplNo is probably better. Most likely, it's unique enough to be useful for payroll. You cannnot use the ID field in the table if it is an autonumber. If you opt for EmplId as a unique identifier, you need to let me know where it will come from. A form textbox would be good and can be based on the value of the combo box. Should be set by the combo's after update event. It can be hidden (and probably should be).
    I missed your line that says "You cannot use the ID field in the table if it is an autonumber, which it is. For now, lets just assume, if it's best, that the EmployeeID is valid, unique, and will remain. I have verified no duplicates.

  6. #6
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    I missed your line that says "You cannot use the ID field in the table if it is an autonumber, which it is. For now, lets just assume, if it's best, that the EmployeeID is valid, unique, and will remain. I have verified no duplicates.

  7. #7
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Duplicate - Posted in error

  8. #8
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    When I wrote id, I meant EmplID - sorry. Re-read my post and make the substitution and I think you will see my question hasn't really been answered (not your fault). I'm saying EmplName might and should be unique, but EmplName cannot be, and you have indicated the record append is to be based on EmplName.

  9. #9
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Quote Originally Posted by Micron View Post
    When I wrote id, I meant EmplID - sorry. Re-read my post and make the substitution and I think you will see my question hasn't really been answered (not your fault). I'm saying EmplName might and should be unique, but EmplName cannot be, and you have indicated the record append is to be based on EmplName.
    Now I'm Confused. My goal is to record the time. The unique identifier like you said, should not be the name in the instance of potentially having two John Smiths or two Mary Jones. But the EmployeeID will always be a unique value.
    It will be compared duplicates before being assigned to the epmloyee. For instance, we have a Joe Perez and a John Perez. With my current naming convention, both would be JPerez. However one is JPerez, and the other is JPerez2. Also for Jamie Lee and James Lee we have JLee and JLee2.

  10. #10
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    This is what you originally said you wanted to append
    EmployeeName field/column and the current date AND time in "ClockIn"
    I pointed out that you asked for two fields, but show data in three in your picture. We seem to agree that EmplID is unique, but I don't know yet where to get it from.
    you need to let me know where it will come from
    and
    If you need 3, is the EmployeeID in a form control?
    or even if it is to be used
    The EmployeeID field is not required and will be removed.
    My problem is that I'm under the impression that
    - EmplName is not unique
    - EmplID is going to be removed
    - you want to record when Name logs in, but your setup will record times in against the names, not EmplId's.
    So we're both confused. If you want to do this in a manner that is proper and shouldn't cause you grief down the line, this is what I'd do (id means EmplID from now on):
    -your name combo box recordsource should be based on a query that gets id AND name in that order. In design, you set it to have two columns, bound column is 0, width is 0. Width of second (column 1) is whatever you need.
    -tblTimeClock Clockin field data type must be date/time
    -when the selection is made, code should validate password against column 0 (id) not name (1)
    -if OK, code will continue on and append the id, name and date/time
    This I can do if you set it up this way.

  11. #11
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Quote Originally Posted by Micron View Post
    This is what you originally said you wanted to append

    I pointed out that you asked for two fields, but show data in three in your picture. We seem to agree that EmplID is unique, but I don't know yet where to get it from.
    and or even if it is to be used - EmployeeID is in tblEmployee. The order in that table is ID (Autonumber 1,2,3...)EmplName, EmplID, Password.
    My problem is that I'm under the impression that
    - EmplName is not unique - Currently it is unique, but has potential for it not to be.
    - EmplID is going to be removed - No longer the case, due to logically needing a unique ID
    - you want to record when Name logs in, but your setup will record times in against the names, not EmplId's. I would like this yes, due to who will be using the login form. But if it can't be done, then it can't. My main concern is that when reports are run against the tblTimeClock it will be able to show the whole name and not jus the EmplID. If they have to log in against their ID or a new unique numerical ID we provide, then so be it.
    So we're both confused. If you want to do this in a manner that is proper and shouldn't cause you grief down the line, this is what I'd do (id means EmplID from now on):
    -your name combo box recordsource should be based on a query that gets id AND name in that order. In design, you set it to have two columns, bound column is 0, width is 0. Width of second (column 1) is whatever you need.
    -tblTimeClock Clockin field data type must be date/time
    -when the selection is made, code should validate password against column 0 (id) not name (1)
    -if OK, code will continue on and append the id, name and date/time
    This I can do if you set it up this way.
    See my comments. Hope that helps. I also need to clarify that I do not want the form to make ANY changes to tblEmployee. That table's soul purpose is for reference only and will only be maintained in design view. I only want to add/append records to tblTimeClock.
    Last edited by txczshooter; 08-10-2015 at 12:12 PM. Reason: Addtional Detail

  12. #12
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Your comments lead me to believe everything can be as you wish, provided you set up per my instructions. Can you do that?

  13. #13
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Quote Originally Posted by Micron View Post
    Your comments lead me to believe everything can be as you wish, provided you set up per my instructions. Can you do that?
    If you're willing to by my Access "Yoda"....Follow, I will.

  14. #14
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,818
    Do. Or do not. There is no try.

  15. #15
    txczshooter is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    9
    Quote Originally Posted by Micron View Post
    Do. Or do not. There is no try.
    Just don't blind fold me, and I'll do it.

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

Similar Threads

  1. Password validation not working
    By nika.duncan in forum Access
    Replies: 4
    Last Post: 11-22-2013, 11:01 AM
  2. MS Access password filed validation
    By mithu 1992 in forum Access
    Replies: 1
    Last Post: 09-24-2013, 08:21 AM
  3. Data entry validation rule in Form
    By accessn00bie in forum Access
    Replies: 3
    Last Post: 12-07-2012, 01:11 PM
  4. Datasheet entry validation
    By Fstrategic in forum Access
    Replies: 2
    Last Post: 01-19-2012, 07:07 AM
  5. password validation
    By RycherX in forum Forms
    Replies: 1
    Last Post: 02-20-2010, 03:55 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