[RESOLVED] working hours problem-VBForums
Results 1 to 8 of 8

Thread: [RESOLVED] working hours problem

  1. #1

    Thread Starter
    baila como nunca
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,230

    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
    11,851

    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
    baila como nunca
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,230

    Re: working hours problem

    Code:
    EnterID
    EnterIN
    EnterOut
    EnterIN1
    EnterOut2
    EnterTotal

  4. #4

    Thread Starter
    baila como nunca
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,230

    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
    16,001

    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"

    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} {GDI+ Classes/Samples} {Unicode Open/Save Dialog} {Icon Organizer/Extractor}
    {VB and DPI Tutorial} {XP/Vista Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    baila como nunca
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,230

    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
    11,851

    Re: working hours problem

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

  8. #8

    Thread Starter
    baila como nunca
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    4,230

    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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.