Results 1 to 6 of 6
  1. #1
    wjm821 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2021
    Posts
    6

    Time Clock Clocking Out

    I have a time clock that works great, except clocking out, it will create another timeclockID. I've searched the forum and the more I see the more I get lost/fustrated on solving the problem.

    tblTimeCard
    TimeCardID(PK)


    EmpID
    TimeIn
    TimeOut

    tblEmployee
    EmpID(PK)
    EmpName
    EmpPosition

    frmTimeClock (set to open as new record)
    txbUnbound (fills in from login form EmpName) txtEmpName
    cmboEmpPosition (EmpPosition, EmpID)
    Buttons that fill in date/time for TimeIn and TimeOut
    Save Button

    How do you open the form to the record with the TimeIN so you can enter the TimeOut instead of creating to TimeCardID's. I did create a query that pulls all the employee's that have not clocked out.

    Thank you in advance

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    You could use DMax() to get the last id for the employee, then FindFirst with that value to get to the record.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    use a form to load the persons ID, and clockout….

    get the users last entry rec in query1:
    Q1: select ID, MAX(TimeCardID) from table where TimeOut is null and [id]=forms!fMyform!txtID

    then update the missing field:
    Q2: update table, Q1 set [timeout] = forms!fMyform!txtTimeOut where [id]=forms!fMyform!txtID and table.ID = Q1.ID


  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Since there should be only one record for the employee where TimeOut is null, probably don't need Max()

    CurrentDb.Execute "UPDATE tblTimeCard SET TimeOut = Now() WHERE EmpID = " & Me.tbxEmp & " AND TimeOut IS NULL";

    Of course, this assumes employee did a proper check in. Could include more code to verify.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    wjm821 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2021
    Posts
    6
    Hate to sound stupid, but where would I put this code. Button to open timecard, onload/onopen timecard? Thank you

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Open a form where user enters their ID and hours. Have a button with code. Code should include validation to verify ID and hours filled in before trying to save.

    What do you mean by you 'have a time clock' - this is just a form in Access?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Time Clock Data Report
    By CharissaBelle in forum Reports
    Replies: 11
    Last Post: 02-01-2018, 01:05 PM
  2. Time Clock Query
    By bennyhana88 in forum Queries
    Replies: 9
    Last Post: 07-08-2015, 04:26 PM
  3. Time Clock Code
    By MakaiKing0 in forum Database Design
    Replies: 8
    Last Post: 04-08-2013, 06:10 AM
  4. Set Clock Time Alarm in a Form
    By rkalapura in forum Forms
    Replies: 3
    Last Post: 11-15-2012, 08:04 PM
  5. real time clock
    By krai in forum Access
    Replies: 1
    Last Post: 05-13-2010, 05:11 AM

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