Results 1 to 8 of 8

Thread: [RESOLVED] working hours problem

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] working hours problem

    hey
    i have a employee that enters in and out twice every day
    the first enter in and out works find and calculates the minutes
    but when he enters back in and enters out
    the total minutes dosnt calculate it.only the first and second enter
    need some help please
    this is my code
    Code:
    CN.Execute "Update Enterwork SET [EnterTotal]=DateDiff(""n"", [EnterIn],[EnterOut]) + DateDiff(""n"", [EnterIN1],[EnterOut2]) WHERE [EnterID]= " & EnterEmpID
    regards
    salsa31

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: working hours problem

    At a glance it looks like it should work though I would probably not do it that way.

    What result are you actually getting?
    Can't tell from your description as you say only the first and second enter which logically would mean the first shift and the second shift which would be all of it but then you use the word enter everywhere so it is kind of meaningless.

    It would make a lot more sense if it was named according to what they actually mean, like

    tblTimeClock EmpID, TimeIn, TimeOut, MinutesWorked
    Last edited by DataMiser; Apr 20th, 2017 at 03:25 PM.

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: working hours problem

    Code:
    EnterID
    EnterIN
    EnterOut
    EnterIN1
    EnterOut2
    EnterTotal

  4. #4

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: working hours problem

    At a glance it looks like it should work though I would probably not do it that way.
    what way can you show me

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: working hours problem

    For the ones that fail, are any of the time entries NULL? If so, you'll probably have to make your SQL statement a bit more complex and test if those values for NULL.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: working hours problem

    Quote Originally Posted by LaVolpe View Post
    For the ones that fail, are any of the time entries NULL? If so, you'll probably have to make your SQL statement a bit more complex and test if those values for NULL.
    is this code ok sir?
    no null values

  7. #7
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: working hours problem

    What results are you actually getting?
    Your description of the problem is not very clear.

  8. #8

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: working hours problem

    well sir i just found the problem with the ID in the DB
    working to fix it
    tnx for the help DM & LaVolpe

Posting Permissions

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



Click Here to Expand Forum to Full Width