Results 1 to 3 of 3
  1. #1
    Join Date
    May 2003

    Unanswered: findrecord in form by user input and date()

    I am trying to create a simple employee timeclock database , I have a table "clock" and a "clockin" form and a "clockout" form , when an employee clocks out I want them to simply enter their 4 digit id number into the form then click a button that searches the database for the record with that ID number and the current date , display that record in the form , then when the employee clicks the "clockout" button I want to update only the "clockout" field of the current record with the current time .

    I'm sure this can be done using findrecord in visual basic but I don't have a clue where to start !

  2. #2
    Join Date
    May 2003
    Provided Answers: 5
    ok - create a form with basically two buttons - In and out
    when user clicks the "in" button you can use an append query :
    docmd.openquery "appendqueryname"
    assuming you are adding these records to a table)
    to add the currentuser, the date, and into the clockin field the reserved word Now()

    when the user clicks out run an update query that updates the record
    docmd.openquery "updatequeryname"
    using the criteria in the query currentuser and the date field = DATE()
    update into the clockout field the reserved word Now()

    This will create the a timestamp (fundamentally) for the user the date and in and out

    You can view the records on a form if you wish and format the in/out textboxes as Time

    HTH - message back if there is a problem

    Also you can use VB(dao) to do this as well but if you are rather new the query method is fine

    ps if you do not want Access to message back to the user that you are adding or updating a record
    in the code behind the buttons the first line will read

    docmd.setwarnings false

    the last line (before end sub) is
    docmd.setwarnings true

  3. #3
    Join Date
    May 2003

    Thanks !

    I will give this a try and see where it gets me but it sounds like a pretty straight forward approach !

    Thanks !

Posting Permissions

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