Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How to Prevent Multiple Time in/Out on the same day

Discussion in 'Information Technology' started by Resty, Jul 28, 2006.

  1. Resty

    Resty
    Expand Collapse
    Guest

    Hi, Guys! Greetings!
    I have developed a payroll application using MS Access. Now my problem is, I
    want to prevent our employees to have multiple Time In/Time Out. Is it
    possible?

    Thanks in advance!
    --
    My sincerest thanks. . . and may the good Lord bless you always and give
    you more knowledge and intelligence to share with us novice. Thank you very
    much!

    Resty A. Morales
     
  2. Loading...

    Similar Threads Forum Date
    How to prevent sikh erosion? Blogs Oct 21, 2015
    Leisure Stomach Protection / Prevention for travelling to India?? Business, Lifestyle & Leisure Oct 18, 2013
    Controversial Panch Pardhani leader arrested; prevented from attending Shaheedi samagam of Bhai Jaspal Singh Hard Talk Mar 30, 2013
    World Women must play greater role in conflict prevention, UN says Breaking News Oct 28, 2011
    Sikh Coalition Bullying Prevention Summit. Register Today! Sikh Organisations Oct 19, 2011

  3. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    It's hard to give a precise answer without knowing more about the tables in
    your application.

    How are you accepting input for Time In/Time Out today? You should be able
    to put logic in the BeforeUpdate event associated with that control to check
    whether or not there's already input for the day. However, are you sure
    you're never going to need to accept split shifts?

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    news:EF5D19D8-4270-476A-AEA6-03DF5DC6B317@microsoft.com...
    > Hi, Guys! Greetings!
    > I have developed a payroll application using MS Access. Now my problem is,

    I
    > want to prevent our employees to have multiple Time In/Time Out. Is it
    > possible?
    >
    > Thanks in advance!
    > --
    > My sincerest thanks. . . and may the good Lord bless you always and give
    > you more knowledge and intelligence to share with us novice. Thank you

    very
    > much!
    >
    > Resty A. Morales
     
  4. Nikos Yannacopoulos

    Nikos Yannacopoulos
    Expand Collapse
    Guest

    Resty,

    It's definitely possible, but the how depends on your design, which
    you're not telling us anything about.
    For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    TimeOut, making a composite primary key on EmployeeID and WorkDate will
    do the trick.

    Nikos
     
  5. Resty

    Resty
    Expand Collapse
    Guest

    Hi Mr. Steele and Nicos!

    Thank you very much for the prompt reply. Below is the scenario how
    employees punch their time in/time out:

    1. Login box is the startup form asking an employee number and passcode.
    2. If the employee number and passcode match, Login box closes and opens a
    form displaying the employee's picture, name, employee number, etc. This form
    has a subform containing the current date, time in, time out. When he press
    the Enter Key, the form closes and the Login box appears again for the next
    employee.
    3. When employee number and passcode do not match, a message will display
    telling the employee to retry his input and after 3 tries and still employee
    number and passcode do not match, the database closes.

    The above scenario work well, but there are times employees tend to be
    "playful" or something I don't know what. They type their employee number and
    passcode for several time and at the end of the day, when I am all alone in
    the office and audit the database, I am shock (literally!) to find out what
    they do. When I confront them, even issued a memo to them, they said they
    didn't do it. Now I guess, you can picture my predicaments!

    Now, what I want to do is to "validate" every time in/time out. An employee
    should not be allowed to punch in/out if he has already punched his time in
    that morning/afternoon.

    I have tables namely "employees" with EmployeeNumber as the Primary Key; and
    "time" table with TimeID as the primary key and employeeNumber as the foreign
    key.

    Please help and thank you very much!

    --
    My sincerest thanks. . . and may the good Lord bless you always and give
    you more knowledge and intelligence to share with us novice. Thank you very
    much!

    Resty A. Morales


    "Nikos Yannacopoulos" wrote:

    > Resty,
    >
    > It's definitely possible, but the how depends on your design, which
    > you're not telling us anything about.
    > For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    > TimeOut, making a composite primary key on EmployeeID and WorkDate will
    > do the trick.
    >
    > Nikos
    >
     
  6. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    When you're checking that the Employee Number and Passcode are valid, also
    check to see whether there's already an entry in the Time table for that
    employee today.

    Assuming that TimeID is a timestamp (date and time), compare
    DateValue([TimeID]) to Date().

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    news:621AFD3B-BBDD-4010-93F1-36B55D427C6E@microsoft.com...
    > Hi Mr. Steele and Nicos!
    >
    > Thank you very much for the prompt reply. Below is the scenario how
    > employees punch their time in/time out:
    >
    > 1. Login box is the startup form asking an employee number and passcode.
    > 2. If the employee number and passcode match, Login box closes and opens a
    > form displaying the employee's picture, name, employee number, etc. This

    form
    > has a subform containing the current date, time in, time out. When he

    press
    > the Enter Key, the form closes and the Login box appears again for the

    next
    > employee.
    > 3. When employee number and passcode do not match, a message will display
    > telling the employee to retry his input and after 3 tries and still

    employee
    > number and passcode do not match, the database closes.
    >
    > The above scenario work well, but there are times employees tend to be
    > "playful" or something I don't know what. They type their employee number

    and
    > passcode for several time and at the end of the day, when I am all alone

    in
    > the office and audit the database, I am shock (literally!) to find out

    what
    > they do. When I confront them, even issued a memo to them, they said they
    > didn't do it. Now I guess, you can picture my predicaments!
    >
    > Now, what I want to do is to "validate" every time in/time out. An

    employee
    > should not be allowed to punch in/out if he has already punched his time

    in
    > that morning/afternoon.
    >
    > I have tables namely "employees" with EmployeeNumber as the Primary Key;

    and
    > "time" table with TimeID as the primary key and employeeNumber as the

    foreign
    > key.
    >
    > Please help and thank you very much!
    >
    > --
    > My sincerest thanks. . . and may the good Lord bless you always and give
    > you more knowledge and intelligence to share with us novice. Thank you

    very
    > much!
    >
    > Resty A. Morales
    >
    >
    > "Nikos Yannacopoulos" wrote:
    >
    > > Resty,
    > >
    > > It's definitely possible, but the how depends on your design, which
    > > you're not telling us anything about.
    > > For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    > > TimeOut, making a composite primary key on EmployeeID and WorkDate will
    > > do the trick.
    > >
    > > Nikos
    > >
     
  7. Resty

    Resty
    Expand Collapse
    Guest

    Hi, Mr. Steele. Thanks for the reply. I understand what you are trying to
    tell me but somehow I'm at a loss within my code. I don't know where and what
    code to insert. I also realized that I need to block an employee's time out
    when he failed/forgot to punch in when he came to work that day. Here's my
    complete code:

    Private Sub cmdLogIn_click()
    On Error GoTo Err_cmdLogin_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "DTR AM"

    stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]

    If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    MsgBox "Please enter your Employee I.D.", vbOKOnly, "Employee Number
    Required!"
    Me.EmployeeNumber.SetFocus
    Exit Sub
    End If

    If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    MsgBox "Please enter your passcode.", vbOKOnly, "Passcode Required!"
    Me.Passcode.SetFocus
    Exit Sub
    End If

    If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    EmployeeNumber = Me.EmployeeNumber.Value



    DoCmd.Close acForm, "log in", acSaveNo
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Else
    MsgBox "Sorry, but your passcode is invalid! Please try again",
    vbOKOnly, "Passcode Invalid!"
    Me.Passcode.SetFocus
    End If

    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 3 Then
    MsgBox "I am sorry, but the system cannot verify your identification." &
    vbNewLine & vbNewLine & _
    "Please call your System Administrator.", vbCritical, "Employee
    Identification Failed!"
    DoCmd.Close

    End If
    Exit_cmdLogin_Click:
    Exit Sub

    Err_cmdLogin_Click:
    MsgBox Err.Description, , "Bundy Clock"
    Resume Exit_cmdLogin_Click


    End Sub



    Private Sub cmdLogOut_Click()
    On Error GoTo Err_cmdLogOut_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "DTR PM"

    stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]

    If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    MsgBox "Please enter your Employee I.D.", vbOKOnly, "Require Data"
    Me.EmployeeNumber.SetFocus
    Exit Sub
    End If

    If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    MsgBox "Please enter your passcode.", vbOKOnly, "Required Data"
    Me.Passcode.SetFocus
    Exit Sub
    End If

    If Me.Passcode.Value = DLookup("passcode", "Employees for Payroll",
    "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    EmployeeNumber = Me.EmployeeNumber.Value


    DoCmd.Close acForm, "log in", acSaveNo
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Else
    MsgBox "Sorry, but your passcode is invalid! Please try again",
    vbOKOnly, "Passcode Invalid!"
    Me.Passcode.SetFocus
    End If

    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 3 Then
    MsgBox "I am sorry, but the system cannot verify your identification." &
    vbNewLine & vbNewLine & _
    "Please call your System Administrator.", vbCritical, "Employee
    Identification Failed!"
    DoCmd.Close


    End If
    Exit_cmdLogOut_Click:
    Exit Sub

    Err_cmdLogOut_Click:
    MsgBox Err.Description, , "Bundy Clock"
    Resume Exit_cmdLogOut_Click


    End Sub


    --
    My sincerest thanks. . . and may the good Lord bless you always and give
    you more knowledge and intelligence to share with us novice. Thank you very
    much!

    Resty A. Morales


    "Douglas J Steele" wrote:

    > When you're checking that the Employee Number and Passcode are valid, also
    > check to see whether there's already an entry in the Time table for that
    > employee today.
    >
    > Assuming that TimeID is a timestamp (date and time), compare
    > DateValue([TimeID]) to Date().
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > news:621AFD3B-BBDD-4010-93F1-36B55D427C6E@microsoft.com...
    > > Hi Mr. Steele and Nicos!
    > >
    > > Thank you very much for the prompt reply. Below is the scenario how
    > > employees punch their time in/time out:
    > >
    > > 1. Login box is the startup form asking an employee number and passcode.
    > > 2. If the employee number and passcode match, Login box closes and opens a
    > > form displaying the employee's picture, name, employee number, etc. This

    > form
    > > has a subform containing the current date, time in, time out. When he

    > press
    > > the Enter Key, the form closes and the Login box appears again for the

    > next
    > > employee.
    > > 3. When employee number and passcode do not match, a message will display
    > > telling the employee to retry his input and after 3 tries and still

    > employee
    > > number and passcode do not match, the database closes.
    > >
    > > The above scenario work well, but there are times employees tend to be
    > > "playful" or something I don't know what. They type their employee number

    > and
    > > passcode for several time and at the end of the day, when I am all alone

    > in
    > > the office and audit the database, I am shock (literally!) to find out

    > what
    > > they do. When I confront them, even issued a memo to them, they said they
    > > didn't do it. Now I guess, you can picture my predicaments!
    > >
    > > Now, what I want to do is to "validate" every time in/time out. An

    > employee
    > > should not be allowed to punch in/out if he has already punched his time

    > in
    > > that morning/afternoon.
    > >
    > > I have tables namely "employees" with EmployeeNumber as the Primary Key;

    > and
    > > "time" table with TimeID as the primary key and employeeNumber as the

    > foreign
    > > key.
    > >
    > > Please help and thank you very much!
    > >
    > > --
    > > My sincerest thanks. . . and may the good Lord bless you always and give
    > > you more knowledge and intelligence to share with us novice. Thank you

    > very
    > > much!
    > >
    > > Resty A. Morales
    > >
    > >
    > > "Nikos Yannacopoulos" wrote:
    > >
    > > > Resty,
    > > >
    > > > It's definitely possible, but the how depends on your design, which
    > > > you're not telling us anything about.
    > > > For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    > > > TimeOut, making a composite primary key on EmployeeID and WorkDate will
    > > > do the trick.
    > > >
    > > > Nikos
    > > >

    >
    >
    >
     
  8. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    After the section of code:

    If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    EmployeeNumber = Me.EmployeeNumber.Value

    you know that it's a valid employee number and passcode.

    Assuming your Time table has EmployeeNumber and TimeID as fields in it, you
    could then use something like:

    If IsNull(DLookup("TimeID", "Time", "[EmployeeNumber]=" & EmployeeNumber
    & _
    " AND DateValue([TimeID])=" & Date()) Then

    If that's true, then the employee hasn't got an entry for today. If it's
    false, they have.

    If you still can't follow, you're going to have to give more details such as
    what your tables look like.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    news:CBF0FFF1-FB79-4EEB-A7C9-7059F5225963@microsoft.com...
    > Hi, Mr. Steele. Thanks for the reply. I understand what you are trying to
    > tell me but somehow I'm at a loss within my code. I don't know where and

    what
    > code to insert. I also realized that I need to block an employee's time

    out
    > when he failed/forgot to punch in when he came to work that day. Here's my
    > complete code:
    >
    > Private Sub cmdLogIn_click()
    > On Error GoTo Err_cmdLogin_Click
    >
    > Dim stDocName As String
    > Dim stLinkCriteria As String
    >
    > stDocName = "DTR AM"
    >
    > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    >
    > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Employee

    Number
    > Required!"
    > Me.EmployeeNumber.SetFocus
    > Exit Sub
    > End If
    >
    > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > MsgBox "Please enter your passcode.", vbOKOnly, "Passcode

    Required!"
    > Me.Passcode.SetFocus
    > Exit Sub
    > End If
    >
    > If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > EmployeeNumber = Me.EmployeeNumber.Value
    >
    >
    >
    > DoCmd.Close acForm, "log in", acSaveNo
    > DoCmd.OpenForm stDocName, , , stLinkCriteria
    >
    > Else
    > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > vbOKOnly, "Passcode Invalid!"
    > Me.Passcode.SetFocus
    > End If
    >
    > intLogonAttempts = intLogonAttempts + 1
    > If intLogonAttempts > 3 Then
    > MsgBox "I am sorry, but the system cannot verify your identification."

    &
    > vbNewLine & vbNewLine & _
    > "Please call your System Administrator.", vbCritical, "Employee
    > Identification Failed!"
    > DoCmd.Close
    >
    > End If
    > Exit_cmdLogin_Click:
    > Exit Sub
    >
    > Err_cmdLogin_Click:
    > MsgBox Err.Description, , "Bundy Clock"
    > Resume Exit_cmdLogin_Click
    >
    >
    > End Sub
    >
    >
    >
    > Private Sub cmdLogOut_Click()
    > On Error GoTo Err_cmdLogOut_Click
    >
    > Dim stDocName As String
    > Dim stLinkCriteria As String
    >
    > stDocName = "DTR PM"
    >
    > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    >
    > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Require Data"
    > Me.EmployeeNumber.SetFocus
    > Exit Sub
    > End If
    >
    > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > MsgBox "Please enter your passcode.", vbOKOnly, "Required Data"
    > Me.Passcode.SetFocus
    > Exit Sub
    > End If
    >
    > If Me.Passcode.Value = DLookup("passcode", "Employees for Payroll",
    > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > EmployeeNumber = Me.EmployeeNumber.Value
    >
    >
    > DoCmd.Close acForm, "log in", acSaveNo
    > DoCmd.OpenForm stDocName, , , stLinkCriteria
    >
    > Else
    > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > vbOKOnly, "Passcode Invalid!"
    > Me.Passcode.SetFocus
    > End If
    >
    > intLogonAttempts = intLogonAttempts + 1
    > If intLogonAttempts > 3 Then
    > MsgBox "I am sorry, but the system cannot verify your identification."

    &
    > vbNewLine & vbNewLine & _
    > "Please call your System Administrator.", vbCritical, "Employee
    > Identification Failed!"
    > DoCmd.Close
    >
    >
    > End If
    > Exit_cmdLogOut_Click:
    > Exit Sub
    >
    > Err_cmdLogOut_Click:
    > MsgBox Err.Description, , "Bundy Clock"
    > Resume Exit_cmdLogOut_Click
    >
    >
    > End Sub
    >
    >
    > --
    > My sincerest thanks. . . and may the good Lord bless you always and give
    > you more knowledge and intelligence to share with us novice. Thank you

    very
    > much!
    >
    > Resty A. Morales
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > When you're checking that the Employee Number and Passcode are valid,

    also
    > > check to see whether there's already an entry in the Time table for that
    > > employee today.
    > >
    > > Assuming that TimeID is a timestamp (date and time), compare
    > > DateValue([TimeID]) to Date().
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > > news:621AFD3B-BBDD-4010-93F1-36B55D427C6E@microsoft.com...
    > > > Hi Mr. Steele and Nicos!
    > > >
    > > > Thank you very much for the prompt reply. Below is the scenario how
    > > > employees punch their time in/time out:
    > > >
    > > > 1. Login box is the startup form asking an employee number and

    passcode.
    > > > 2. If the employee number and passcode match, Login box closes and

    opens a
    > > > form displaying the employee's picture, name, employee number, etc.

    This
    > > form
    > > > has a subform containing the current date, time in, time out. When he

    > > press
    > > > the Enter Key, the form closes and the Login box appears again for the

    > > next
    > > > employee.
    > > > 3. When employee number and passcode do not match, a message will

    display
    > > > telling the employee to retry his input and after 3 tries and still

    > > employee
    > > > number and passcode do not match, the database closes.
    > > >
    > > > The above scenario work well, but there are times employees tend to

    be
    > > > "playful" or something I don't know what. They type their employee

    number
    > > and
    > > > passcode for several time and at the end of the day, when I am all

    alone
    > > in
    > > > the office and audit the database, I am shock (literally!) to find out

    > > what
    > > > they do. When I confront them, even issued a memo to them, they said

    they
    > > > didn't do it. Now I guess, you can picture my predicaments!
    > > >
    > > > Now, what I want to do is to "validate" every time in/time out. An

    > > employee
    > > > should not be allowed to punch in/out if he has already punched his

    time
    > > in
    > > > that morning/afternoon.
    > > >
    > > > I have tables namely "employees" with EmployeeNumber as the Primary

    Key;
    > > and
    > > > "time" table with TimeID as the primary key and employeeNumber as the

    > > foreign
    > > > key.
    > > >
    > > > Please help and thank you very much!
    > > >
    > > > --
    > > > My sincerest thanks. . . and may the good Lord bless you always and

    give
    > > > you more knowledge and intelligence to share with us novice. Thank you

    > > very
    > > > much!
    > > >
    > > > Resty A. Morales
    > > >
    > > >
    > > > "Nikos Yannacopoulos" wrote:
    > > >
    > > > > Resty,
    > > > >
    > > > > It's definitely possible, but the how depends on your design, which
    > > > > you're not telling us anything about.
    > > > > For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    > > > > TimeOut, making a composite primary key on EmployeeID and WorkDate

    will
    > > > > do the trick.
    > > > >
    > > > > Nikos
    > > > >

    > >
    > >
    > >
     
  9. Resty

    Resty
    Expand Collapse
    Guest

    Hi, Mr. Steele! Good morning! You know what? I opened my pc and checked my
    email as soon as I got up from my bed. Thanks for the help. I'll check if
    it'll work later. Looks like i'm enlightened by your showing me the correct
    insertion point and the correct code. Thanks a lot, man! I'll let you know if
    it works. Have a nice day and God bless you all for all the help (for all
    your patience and effort trying to help us.)
    --
    My sincerest thanks. . . and may the good Lord bless you always and give
    you more knowledge and intelligence to share with us novice. Thank you very
    much!

    Resty A. Morales


    "Douglas J Steele" wrote:

    > After the section of code:
    >
    > If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > EmployeeNumber = Me.EmployeeNumber.Value
    >
    > you know that it's a valid employee number and passcode.
    >
    > Assuming your Time table has EmployeeNumber and TimeID as fields in it, you
    > could then use something like:
    >
    > If IsNull(DLookup("TimeID", "Time", "[EmployeeNumber]=" & EmployeeNumber
    > & _
    > " AND DateValue([TimeID])=" & Date()) Then
    >
    > If that's true, then the employee hasn't got an entry for today. If it's
    > false, they have.
    >
    > If you still can't follow, you're going to have to give more details such as
    > what your tables look like.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > news:CBF0FFF1-FB79-4EEB-A7C9-7059F5225963@microsoft.com...
    > > Hi, Mr. Steele. Thanks for the reply. I understand what you are trying to
    > > tell me but somehow I'm at a loss within my code. I don't know where and

    > what
    > > code to insert. I also realized that I need to block an employee's time

    > out
    > > when he failed/forgot to punch in when he came to work that day. Here's my
    > > complete code:
    > >
    > > Private Sub cmdLogIn_click()
    > > On Error GoTo Err_cmdLogin_Click
    > >
    > > Dim stDocName As String
    > > Dim stLinkCriteria As String
    > >
    > > stDocName = "DTR AM"
    > >
    > > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    > >
    > > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Employee

    > Number
    > > Required!"
    > > Me.EmployeeNumber.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > > MsgBox "Please enter your passcode.", vbOKOnly, "Passcode

    > Required!"
    > > Me.Passcode.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > EmployeeNumber = Me.EmployeeNumber.Value
    > >
    > >
    > >
    > > DoCmd.Close acForm, "log in", acSaveNo
    > > DoCmd.OpenForm stDocName, , , stLinkCriteria
    > >
    > > Else
    > > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > > vbOKOnly, "Passcode Invalid!"
    > > Me.Passcode.SetFocus
    > > End If
    > >
    > > intLogonAttempts = intLogonAttempts + 1
    > > If intLogonAttempts > 3 Then
    > > MsgBox "I am sorry, but the system cannot verify your identification."

    > &
    > > vbNewLine & vbNewLine & _
    > > "Please call your System Administrator.", vbCritical, "Employee
    > > Identification Failed!"
    > > DoCmd.Close
    > >
    > > End If
    > > Exit_cmdLogin_Click:
    > > Exit Sub
    > >
    > > Err_cmdLogin_Click:
    > > MsgBox Err.Description, , "Bundy Clock"
    > > Resume Exit_cmdLogin_Click
    > >
    > >
    > > End Sub
    > >
    > >
    > >
    > > Private Sub cmdLogOut_Click()
    > > On Error GoTo Err_cmdLogOut_Click
    > >
    > > Dim stDocName As String
    > > Dim stLinkCriteria As String
    > >
    > > stDocName = "DTR PM"
    > >
    > > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    > >
    > > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Require Data"
    > > Me.EmployeeNumber.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > > MsgBox "Please enter your passcode.", vbOKOnly, "Required Data"
    > > Me.Passcode.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If Me.Passcode.Value = DLookup("passcode", "Employees for Payroll",
    > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > EmployeeNumber = Me.EmployeeNumber.Value
    > >
    > >
    > > DoCmd.Close acForm, "log in", acSaveNo
    > > DoCmd.OpenForm stDocName, , , stLinkCriteria
    > >
    > > Else
    > > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > > vbOKOnly, "Passcode Invalid!"
    > > Me.Passcode.SetFocus
    > > End If
    > >
    > > intLogonAttempts = intLogonAttempts + 1
    > > If intLogonAttempts > 3 Then
    > > MsgBox "I am sorry, but the system cannot verify your identification."

    > &
    > > vbNewLine & vbNewLine & _
    > > "Please call your System Administrator.", vbCritical, "Employee
    > > Identification Failed!"
    > > DoCmd.Close
    > >
    > >
    > > End If
    > > Exit_cmdLogOut_Click:
    > > Exit Sub
    > >
    > > Err_cmdLogOut_Click:
    > > MsgBox Err.Description, , "Bundy Clock"
    > > Resume Exit_cmdLogOut_Click
    > >
    > >
    > > End Sub
    > >
    > >
    > > --
    > > My sincerest thanks. . . and may the good Lord bless you always and give
    > > you more knowledge and intelligence to share with us novice. Thank you

    > very
    > > much!
    > >
    > > Resty A. Morales
    > >
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > When you're checking that the Employee Number and Passcode are valid,

    > also
    > > > check to see whether there's already an entry in the Time table for that
    > > > employee today.
    > > >
    > > > Assuming that TimeID is a timestamp (date and time), compare
    > > > DateValue([TimeID]) to Date().
    > > >
    > > > --
    > > > Doug Steele, Microsoft Access MVP
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > > > news:621AFD3B-BBDD-4010-93F1-36B55D427C6E@microsoft.com...
    > > > > Hi Mr. Steele and Nicos!
    > > > >
    > > > > Thank you very much for the prompt reply. Below is the scenario how
    > > > > employees punch their time in/time out:
    > > > >
    > > > > 1. Login box is the startup form asking an employee number and

    > passcode.
    > > > > 2. If the employee number and passcode match, Login box closes and

    > opens a
    > > > > form displaying the employee's picture, name, employee number, etc.

    > This
    > > > form
    > > > > has a subform containing the current date, time in, time out. When he
    > > > press
    > > > > the Enter Key, the form closes and the Login box appears again for the
    > > > next
    > > > > employee.
    > > > > 3. When employee number and passcode do not match, a message will

    > display
    > > > > telling the employee to retry his input and after 3 tries and still
    > > > employee
    > > > > number and passcode do not match, the database closes.
    > > > >
    > > > > The above scenario work well, but there are times employees tend to

    > be
    > > > > "playful" or something I don't know what. They type their employee

    > number
    > > > and
    > > > > passcode for several time and at the end of the day, when I am all

    > alone
    > > > in
    > > > > the office and audit the database, I am shock (literally!) to find out
    > > > what
    > > > > they do. When I confront them, even issued a memo to them, they said

    > they
    > > > > didn't do it. Now I guess, you can picture my predicaments!
    > > > >
    > > > > Now, what I want to do is to "validate" every time in/time out. An
    > > > employee
    > > > > should not be allowed to punch in/out if he has already punched his

    > time
    > > > in
    > > > > that morning/afternoon.
    > > > >
    > > > > I have tables namely "employees" with EmployeeNumber as the Primary

    > Key;
    > > > and
    > > > > "time" table with TimeID as the primary key and employeeNumber as the
    > > > foreign
    > > > > key.
    > > > >
    > > > > Please help and thank you very much!
    > > > >
    > > > > --
    > > > > My sincerest thanks. . . and may the good Lord bless you always and

    > give
    > > > > you more knowledge and intelligence to share with us novice. Thank you
    > > > very
    > > > > much!
    > > > >
    > > > > Resty A. Morales
    > > > >
    > > > >
    > > > > "Nikos Yannacopoulos" wrote:
    > > > >
    > > > > > Resty,
    > > > > >
    > > > > > It's definitely possible, but the how depends on your design, which
    > > > > > you're not telling us anything about.
    > > > > > For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    > > > > > TimeOut, making a composite primary key on EmployeeID and WorkDate

    > will
    > > > > > do the trick.
    > > > > >
    > > > > > Nikos
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
  10. Resty

    Resty
    Expand Collapse
    Guest

    Hi, Mr. Steele! Good day! Sorry but I can't make the code work. I tried to
    rewrite the code the way you suggested but it still accepts punch ins
    although there has been an entry for that day. Below is the structure of my
    tables:

    TIME TABLE
    TimeID (Autonumber) Primary Key
    EmployeeNumber (Number) related to "Employees" Table (relationship = one to
    many)
    Date (Date/Time) Default value=now()
    Am_In (Date/Time) Format=short time
    Am_Out(Date/Time) Format=short time; DefaultValue=#12:00:00 PM#
    Pm_In(Date/Time)Format=short time; DefaultValue=#1:00:00 PM#
    Pm_Out(Date/Time) Format=short time

    EMPLOYEES TABLE
    EmployeeNumber (Number) this is the primary key related to Time table
    FirstName (Text)
    MiddleName(text)
    LastName(text)
    Passcode (text)

    Thank you very much for the patience and effort. God bless you!

    Resty

    --
    My sincerest thanks. . . and may the good Lord bless you always and give
    you more knowledge and intelligence to share with us novice. Thank you very
    much!

    Resty A. Morales


    "Douglas J Steele" wrote:

    > After the section of code:
    >
    > If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > EmployeeNumber = Me.EmployeeNumber.Value
    >
    > you know that it's a valid employee number and passcode.
    >
    > Assuming your Time table has EmployeeNumber and TimeID as fields in it, you
    > could then use something like:
    >
    > If IsNull(DLookup("TimeID", "Time", "[EmployeeNumber]=" & EmployeeNumber
    > & _
    > " AND DateValue([TimeID])=" & Date()) Then
    >
    > If that's true, then the employee hasn't got an entry for today. If it's
    > false, they have.
    >
    > If you still can't follow, you're going to have to give more details such as
    > what your tables look like.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > news:CBF0FFF1-FB79-4EEB-A7C9-7059F5225963@microsoft.com...
    > > Hi, Mr. Steele. Thanks for the reply. I understand what you are trying to
    > > tell me but somehow I'm at a loss within my code. I don't know where and

    > what
    > > code to insert. I also realized that I need to block an employee's time

    > out
    > > when he failed/forgot to punch in when he came to work that day. Here's my
    > > complete code:
    > >
    > > Private Sub cmdLogIn_click()
    > > On Error GoTo Err_cmdLogin_Click
    > >
    > > Dim stDocName As String
    > > Dim stLinkCriteria As String
    > >
    > > stDocName = "DTR AM"
    > >
    > > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    > >
    > > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Employee

    > Number
    > > Required!"
    > > Me.EmployeeNumber.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > > MsgBox "Please enter your passcode.", vbOKOnly, "Passcode

    > Required!"
    > > Me.Passcode.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > EmployeeNumber = Me.EmployeeNumber.Value
    > >
    > >
    > >
    > > DoCmd.Close acForm, "log in", acSaveNo
    > > DoCmd.OpenForm stDocName, , , stLinkCriteria
    > >
    > > Else
    > > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > > vbOKOnly, "Passcode Invalid!"
    > > Me.Passcode.SetFocus
    > > End If
    > >
    > > intLogonAttempts = intLogonAttempts + 1
    > > If intLogonAttempts > 3 Then
    > > MsgBox "I am sorry, but the system cannot verify your identification."

    > &
    > > vbNewLine & vbNewLine & _
    > > "Please call your System Administrator.", vbCritical, "Employee
    > > Identification Failed!"
    > > DoCmd.Close
    > >
    > > End If
    > > Exit_cmdLogin_Click:
    > > Exit Sub
    > >
    > > Err_cmdLogin_Click:
    > > MsgBox Err.Description, , "Bundy Clock"
    > > Resume Exit_cmdLogin_Click
    > >
    > >
    > > End Sub
    > >
    > >
    > >
    > > Private Sub cmdLogOut_Click()
    > > On Error GoTo Err_cmdLogOut_Click
    > >
    > > Dim stDocName As String
    > > Dim stLinkCriteria As String
    > >
    > > stDocName = "DTR PM"
    > >
    > > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    > >
    > > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Require Data"
    > > Me.EmployeeNumber.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > > MsgBox "Please enter your passcode.", vbOKOnly, "Required Data"
    > > Me.Passcode.SetFocus
    > > Exit Sub
    > > End If
    > >
    > > If Me.Passcode.Value = DLookup("passcode", "Employees for Payroll",
    > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > EmployeeNumber = Me.EmployeeNumber.Value
    > >
    > >
    > > DoCmd.Close acForm, "log in", acSaveNo
    > > DoCmd.OpenForm stDocName, , , stLinkCriteria
    > >
    > > Else
    > > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > > vbOKOnly, "Passcode Invalid!"
    > > Me.Passcode.SetFocus
    > > End If
    > >
    > > intLogonAttempts = intLogonAttempts + 1
    > > If intLogonAttempts > 3 Then
    > > MsgBox "I am sorry, but the system cannot verify your identification."

    > &
    > > vbNewLine & vbNewLine & _
    > > "Please call your System Administrator.", vbCritical, "Employee
    > > Identification Failed!"
    > > DoCmd.Close
    > >
    > >
    > > End If
    > > Exit_cmdLogOut_Click:
    > > Exit Sub
    > >
    > > Err_cmdLogOut_Click:
    > > MsgBox Err.Description, , "Bundy Clock"
    > > Resume Exit_cmdLogOut_Click
    > >
    > >
    > > End Sub
    > >
    > >
    > > --
    > > My sincerest thanks. . . and may the good Lord bless you always and give
    > > you more knowledge and intelligence to share with us novice. Thank you

    > very
    > > much!
    > >
    > > Resty A. Morales
    > >
    > >
    > > "Douglas J Steele" wrote:
    > >
    > > > When you're checking that the Employee Number and Passcode are valid,

    > also
    > > > check to see whether there's already an entry in the Time table for that
    > > > employee today.
    > > >
    > > > Assuming that TimeID is a timestamp (date and time), compare
    > > > DateValue([TimeID]) to Date().
    > > >
    > > > --
    > > > Doug Steele, Microsoft Access MVP
    > > > http://I.Am/DougSteele
    > > > (no e-mails, please!)
    > > >
    > > >
    > > > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > > > news:621AFD3B-BBDD-4010-93F1-36B55D427C6E@microsoft.com...
    > > > > Hi Mr. Steele and Nicos!
    > > > >
    > > > > Thank you very much for the prompt reply. Below is the scenario how
    > > > > employees punch their time in/time out:
    > > > >
    > > > > 1. Login box is the startup form asking an employee number and

    > passcode.
    > > > > 2. If the employee number and passcode match, Login box closes and

    > opens a
    > > > > form displaying the employee's picture, name, employee number, etc.

    > This
    > > > form
    > > > > has a subform containing the current date, time in, time out. When he
    > > > press
    > > > > the Enter Key, the form closes and the Login box appears again for the
    > > > next
    > > > > employee.
    > > > > 3. When employee number and passcode do not match, a message will

    > display
    > > > > telling the employee to retry his input and after 3 tries and still
    > > > employee
    > > > > number and passcode do not match, the database closes.
    > > > >
    > > > > The above scenario work well, but there are times employees tend to

    > be
    > > > > "playful" or something I don't know what. They type their employee

    > number
    > > > and
    > > > > passcode for several time and at the end of the day, when I am all

    > alone
    > > > in
    > > > > the office and audit the database, I am shock (literally!) to find out
    > > > what
    > > > > they do. When I confront them, even issued a memo to them, they said

    > they
    > > > > didn't do it. Now I guess, you can picture my predicaments!
    > > > >
    > > > > Now, what I want to do is to "validate" every time in/time out. An
    > > > employee
    > > > > should not be allowed to punch in/out if he has already punched his

    > time
    > > > in
    > > > > that morning/afternoon.
    > > > >
    > > > > I have tables namely "employees" with EmployeeNumber as the Primary

    > Key;
    > > > and
    > > > > "time" table with TimeID as the primary key and employeeNumber as the
    > > > foreign
    > > > > key.
    > > > >
    > > > > Please help and thank you very much!
    > > > >
    > > > > --
    > > > > My sincerest thanks. . . and may the good Lord bless you always and

    > give
    > > > > you more knowledge and intelligence to share with us novice. Thank you
    > > > very
    > > > > much!
    > > > >
    > > > > Resty A. Morales
    > > > >
    > > > >
    > > > > "Nikos Yannacopoulos" wrote:
    > > > >
    > > > > > Resty,
    > > > > >
    > > > > > It's definitely possible, but the how depends on your design, which
    > > > > > you're not telling us anything about.
    > > > > > For instance, if there is a table with EmployeeID, WorkDate, TimeIn,
    > > > > > TimeOut, making a composite primary key on EmployeeID and WorkDate

    > will
    > > > > > do the trick.
    > > > > >
    > > > > > Nikos
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
     
  11. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    First piece of advice: rename the Date field in your Time table. For that
    matter, rename your Time table.

    Date and Time are reserved words in Access, and shouldn't be used for your
    own purposes.

    With the names of the fields you currently have, try:

    If IsNull(DLookup("TimeID", "[Time]", "[EmployeeNumber]=" & EmployeeNumber &
    _
    " AND [Date]=" & Date()) Then


    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    news:F241DDF3-4CF4-4493-B604-F146DCFB45C6@microsoft.com...
    > Hi, Mr. Steele! Good day! Sorry but I can't make the code work. I tried to
    > rewrite the code the way you suggested but it still accepts punch ins
    > although there has been an entry for that day. Below is the structure of

    my
    > tables:
    >
    > TIME TABLE
    > TimeID (Autonumber) Primary Key
    > EmployeeNumber (Number) related to "Employees" Table (relationship = one

    to
    > many)
    > Date (Date/Time) Default value=now()
    > Am_In (Date/Time) Format=short time
    > Am_Out(Date/Time) Format=short time; DefaultValue=#12:00:00 PM#
    > Pm_In(Date/Time)Format=short time; DefaultValue=#1:00:00 PM#
    > Pm_Out(Date/Time) Format=short time
    >
    > EMPLOYEES TABLE
    > EmployeeNumber (Number) this is the primary key related to Time table
    > FirstName (Text)
    > MiddleName(text)
    > LastName(text)
    > Passcode (text)
    >
    > Thank you very much for the patience and effort. God bless you!
    >
    > Resty
    >
    > --
    > My sincerest thanks. . . and may the good Lord bless you always and give
    > you more knowledge and intelligence to share with us novice. Thank you

    very
    > much!
    >
    > Resty A. Morales
    >
    >
    > "Douglas J Steele" wrote:
    >
    > > After the section of code:
    > >
    > > If Me.Passcode.Value = DLookup("Passcode", "Employees for Payroll",
    > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > EmployeeNumber = Me.EmployeeNumber.Value
    > >
    > > you know that it's a valid employee number and passcode.
    > >
    > > Assuming your Time table has EmployeeNumber and TimeID as fields in it,

    you
    > > could then use something like:
    > >
    > > If IsNull(DLookup("TimeID", "Time", "[EmployeeNumber]=" &

    EmployeeNumber
    > > & _
    > > " AND DateValue([TimeID])=" & Date()) Then
    > >
    > > If that's true, then the employee hasn't got an entry for today. If it's
    > > false, they have.
    > >
    > > If you still can't follow, you're going to have to give more details

    such as
    > > what your tables look like.
    > >
    > > --
    > > Doug Steele, Microsoft Access MVP
    > > http://I.Am/DougSteele
    > > (no e-mails, please!)
    > >
    > >
    > > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > > news:CBF0FFF1-FB79-4EEB-A7C9-7059F5225963@microsoft.com...
    > > > Hi, Mr. Steele. Thanks for the reply. I understand what you are trying

    to
    > > > tell me but somehow I'm at a loss within my code. I don't know where

    and
    > > what
    > > > code to insert. I also realized that I need to block an employee's

    time
    > > out
    > > > when he failed/forgot to punch in when he came to work that day.

    Here's my
    > > > complete code:
    > > >
    > > > Private Sub cmdLogIn_click()
    > > > On Error GoTo Err_cmdLogin_Click
    > > >
    > > > Dim stDocName As String
    > > > Dim stLinkCriteria As String
    > > >
    > > > stDocName = "DTR AM"
    > > >
    > > > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    > > >
    > > > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > > > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Employee

    > > Number
    > > > Required!"
    > > > Me.EmployeeNumber.SetFocus
    > > > Exit Sub
    > > > End If
    > > >
    > > > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > > > MsgBox "Please enter your passcode.", vbOKOnly, "Passcode

    > > Required!"
    > > > Me.Passcode.SetFocus
    > > > Exit Sub
    > > > End If
    > > >
    > > > If Me.Passcode.Value = DLookup("Passcode", "Employees for

    Payroll",
    > > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > > EmployeeNumber = Me.EmployeeNumber.Value
    > > >
    > > >
    > > >
    > > > DoCmd.Close acForm, "log in", acSaveNo
    > > > DoCmd.OpenForm stDocName, , , stLinkCriteria
    > > >
    > > > Else
    > > > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > > > vbOKOnly, "Passcode Invalid!"
    > > > Me.Passcode.SetFocus
    > > > End If
    > > >
    > > > intLogonAttempts = intLogonAttempts + 1
    > > > If intLogonAttempts > 3 Then
    > > > MsgBox "I am sorry, but the system cannot verify your

    identification."
    > > &
    > > > vbNewLine & vbNewLine & _
    > > > "Please call your System Administrator.", vbCritical, "Employee
    > > > Identification Failed!"
    > > > DoCmd.Close
    > > >
    > > > End If
    > > > Exit_cmdLogin_Click:
    > > > Exit Sub
    > > >
    > > > Err_cmdLogin_Click:
    > > > MsgBox Err.Description, , "Bundy Clock"
    > > > Resume Exit_cmdLogin_Click
    > > >
    > > >
    > > > End Sub
    > > >
    > > >
    > > >
    > > > Private Sub cmdLogOut_Click()
    > > > On Error GoTo Err_cmdLogOut_Click
    > > >
    > > > Dim stDocName As String
    > > > Dim stLinkCriteria As String
    > > >
    > > > stDocName = "DTR PM"
    > > >
    > > > stLinkCriteria = "[EmployeeNumber]=" & Me![EmployeeNumber]
    > > >
    > > > If IsNull(Me.EmployeeNumber) Or Me.EmployeeNumber = "" Then
    > > > MsgBox "Please enter your Employee I.D.", vbOKOnly, "Require

    Data"
    > > > Me.EmployeeNumber.SetFocus
    > > > Exit Sub
    > > > End If
    > > >
    > > > If IsNull(Me.Passcode) Or Me.Passcode = "" Then
    > > > MsgBox "Please enter your passcode.", vbOKOnly, "Required

    Data"
    > > > Me.Passcode.SetFocus
    > > > Exit Sub
    > > > End If
    > > >
    > > > If Me.Passcode.Value = DLookup("passcode", "Employees for

    Payroll",
    > > > "[EmployeeNumber]=" & Me.EmployeeNumber.Value) Then
    > > > EmployeeNumber = Me.EmployeeNumber.Value
    > > >
    > > >
    > > > DoCmd.Close acForm, "log in", acSaveNo
    > > > DoCmd.OpenForm stDocName, , , stLinkCriteria
    > > >
    > > > Else
    > > > MsgBox "Sorry, but your passcode is invalid! Please try again",
    > > > vbOKOnly, "Passcode Invalid!"
    > > > Me.Passcode.SetFocus
    > > > End If
    > > >
    > > > intLogonAttempts = intLogonAttempts + 1
    > > > If intLogonAttempts > 3 Then
    > > > MsgBox "I am sorry, but the system cannot verify your

    identification."
    > > &
    > > > vbNewLine & vbNewLine & _
    > > > "Please call your System Administrator.", vbCritical, "Employee
    > > > Identification Failed!"
    > > > DoCmd.Close
    > > >
    > > >
    > > > End If
    > > > Exit_cmdLogOut_Click:
    > > > Exit Sub
    > > >
    > > > Err_cmdLogOut_Click:
    > > > MsgBox Err.Description, , "Bundy Clock"
    > > > Resume Exit_cmdLogOut_Click
    > > >
    > > >
    > > > End Sub
    > > >
    > > >
    > > > --
    > > > My sincerest thanks. . . and may the good Lord bless you always and

    give
    > > > you more knowledge and intelligence to share with us novice. Thank you

    > > very
    > > > much!
    > > >
    > > > Resty A. Morales
    > > >
    > > >
    > > > "Douglas J Steele" wrote:
    > > >
    > > > > When you're checking that the Employee Number and Passcode are

    valid,
    > > also
    > > > > check to see whether there's already an entry in the Time table for

    that
    > > > > employee today.
    > > > >
    > > > > Assuming that TimeID is a timestamp (date and time), compare
    > > > > DateValue([TimeID]) to Date().
    > > > >
    > > > > --
    > > > > Doug Steele, Microsoft Access MVP
    > > > > http://I.Am/DougSteele
    > > > > (no e-mails, please!)
    > > > >
    > > > >
    > > > > "Resty" <plsdonotsendmail@thisaddress.thankyou.ph> wrote in message
    > > > > news:621AFD3B-BBDD-4010-93F1-36B55D427C6E@microsoft.com...
    > > > > > Hi Mr. Steele and Nicos!
    > > > > >
    > > > > > Thank you very much for the prompt reply. Below is the scenario

    how
    > > > > > employees punch their time in/time out:
    > > > > >
    > > > > > 1. Login box is the startup form asking an employee number and

    > > passcode.
    > > > > > 2. If the employee number and passcode match, Login box closes and

    > > opens a
    > > > > > form displaying the employee's picture, name, employee number,

    etc.
    > > This
    > > > > form
    > > > > > has a subform containing the current date, time in, time out. When

    he
    > > > > press
    > > > > > the Enter Key, the form closes and the Login box appears again for

    the
    > > > > next
    > > > > > employee.
    > > > > > 3. When employee number and passcode do not match, a message will

    > > display
    > > > > > telling the employee to retry his input and after 3 tries and

    still
    > > > > employee
    > > > > > number and passcode do not match, the database closes.
    > > > > >
    > > > > > The above scenario work well, but there are times employees tend

    to
    > > be
    > > > > > "playful" or something I don't know what. They type their employee

    > > number
    > > > > and
    > > > > > passcode for several time and at the end of the day, when I am all

    > > alone
    > > > > in
    > > > > > the office and audit the database, I am shock (literally!) to find

    out
    > > > > what
    > > > > > they do. When I confront them, even issued a memo to them, they

    said
    > > they
    > > > > > didn't do it. Now I guess, you can picture my predicaments!
    > > > > >
    > > > > > Now, what I want to do is to "validate" every time in/time out. An
    > > > > employee
    > > > > > should not be allowed to punch in/out if he has already punched

    his
    > > time
    > > > > in
    > > > > > that morning/afternoon.
    > > > > >
    > > > > > I have tables namely "employees" with EmployeeNumber as the

    Primary
    > > Key;
    > > > > and
    > > > > > "time" table with TimeID as the primary key and employeeNumber as

    the
    > > > > foreign
    > > > > > key.
    > > > > >
    > > > > > Please help and thank you very much!
    > > > > >
    > > > > > --
    > > > > > My sincerest thanks. . . and may the good Lord bless you always

    and
    > > give
    > > > > > you more knowledge and intelligence to share with us novice. Thank

    you
    > > > > very
    > > > > > much!
    > > > > >
    > > > > > Resty A. Morales
    > > > > >
    > > > > >
    > > > > > "Nikos Yannacopoulos" wrote:
    > > > > >
    > > > > > > Resty,
    > > > > > >
    > > > > > > It's definitely possible, but the how depends on your design,

    which
    > > > > > > you're not telling us anything about.
    > > > > > > For instance, if there is a table with EmployeeID, WorkDate,

    TimeIn,
    > > > > > > TimeOut, making a composite primary key on EmployeeID and

    WorkDate
    > > will
    > > > > > > do the trick.
    > > > > > >
    > > > > > > Nikos
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
     

Share This Page