Results 1 to 5 of 5
  1. #1
    Levantin is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Posts
    2

    Problem with Placement of TimeStamps

    Hi All,



    I'm having problems with my database, I spent my time looking for answers in Google yet I can't find any luck.

    I also tried to search this forum and can't find any related topic into it.

    I am not a pro in using Access yet I am learning the curves for my project.

    I have a log in form where in the same time it will put a time stamp into a certain field.



    Here are my tables and field...

    tblMain where in it consist of EmpID (Primary Key)(Data Type : Number), NUser, Pass, EmpName.
    tblTime where in it consist of EmpID (Number), LogInNum (AutoNumber), fldLogIn, fldLogOut.

    I have a form which is NMain, this is where we log in.

    For my log in button I use this :
    Code:
    DoCmd.RunSQL "INSERT INTO tblTime (EmpID, fldLogIn) VALUES ('"  & Me.cboNUser.Value & "',#" & Now() & "#)"
    and for my log out I use this :
    Code:
    "UPDATE tblTime SET tblTime.fldLogOut = Now()" & _
              "WHERE (((tblMain.EmpID)='" & Me.cboNUser.Value & "'));"

    The problem in here is when a person is trying to log out the fldLogOut is updating all the time stamp of all the users.


    For example :

    User 1 logs in 14:00PM
    User 2 logs in 15:30

    After a few moments

    User 2 Logs Out 16:00
    User 1 Logs Out 17:00

    And then it updates User 2's log out time to 17:00 the same as User 1.

    When I try using Insert into statement in log out.

    The problem becames like this :

    1 User 1 15:00(Log In) Null(Log Out)
    2 User 1 Null(Log In) 17:00(Log Out)


    I tried the other guides yet it gives me error like data type mismatch and if the other way around it gives me Enter Paramter Value.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You have the wrong table specified in the criteria portion of the update SQL.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    By the way, when you get more records that would update all records of that employee. Presumably you'd just want the last one, or add a criteria of the end time being null.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    Levantin is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Nov 2013
    Posts
    2
    Hi Sir,

    sorry i've been busy for quite while now are you referring to this?

    Code:
    "UPDATE tblTime SET tblTime.fldLogOut = Now()" & _
              "WHERE (((tblMain.EmpID)='" & Me.cboNUser.Value & "'));"

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Yes, I am.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. placement of .movefirst and .movenext
    By Ruegen in forum Programming
    Replies: 5
    Last Post: 09-18-2013, 08:42 PM
  2. Replies: 9
    Last Post: 06-04-2011, 04:07 AM
  3. Placement of fields within Report Question
    By batowl in forum Reports
    Replies: 1
    Last Post: 03-18-2011, 08:49 AM
  4. MsgBox Placement
    By tpcervelo in forum Programming
    Replies: 2
    Last Post: 12-27-2010, 07:36 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