1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

TimeStop

Discussion in 'Business Applications' started by BoaterJohn, Feb 25, 2013.

Thread Status:
Not open for further replies.
Advertisement
  1. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
    Greetings OBP

    Hope all is well with you. A glitch has cropped up in the access code we worked on posted back on May 8 2012. If you can refer to it fine; otherwise I'll send you a copy of that very small zip file. Anyway it worked great for each record if you clicked the event button to calculate the "TimeDifference" field on the form.

    I tried to make it calulate all the Time Stops in order by "TruckNo" and "StopTime". The property "afterUpdate"
    is not working after I leave the "StopTime" field. I even refreshed with no success. Any ideas to help this problem.
    Thanx,
    boaterjb
     
  2. Cookiegal

    Cookiegal Administrator Malware Specialist Coordinator

    Joined:
    Aug 27, 2003
    Messages:
    114,003
  3. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Are you saying the original code is no longer working?
    I am not sure what you mean by this part "I tried to make it calculate all the Time Stops in order by "TruckNo" and "StopTime"."
     
  4. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
    Hi OBP,
    The calculation works fine using the "Event Butn", but does not work with the "afterupdate" code in the "TimeStop" field. I am doing it manually for each record using the "Event Butn". I would like it to
    calculate each record by only clicking the "Event Butn" once if posible. Hope I made sense.
    Thanx,
    boaterjohn
     
  5. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
  6. Cookiegal

    Cookiegal Administrator Malware Specialist Coordinator

    Joined:
    Aug 27, 2003
    Messages:
    114,003
    You're welcome. :)
     
  7. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Is the code in the After Update event the same as in the button?
    For old records you can also add the code to the "On Current" event procedure, as long as it checks that the field(s) is not null.
     
  8. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
    Yes it is; but if I update the TimeStop field the TimeDiff doesn't calculate. Also, OBP, can I do each record automatically to calculate the "TimeDiff" after I enter all the new records for the day by using a "Event Bnt" like I do now for each record manually clicking for each record?
     
  9. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    OK, I have a question for you, does the Query supplying the form have the Truck Nos, Issue Dates and timestop in Ascending order?

    If the after update event works properly you shouldn't have to update all the entered records, it should work as you enter them.
    I think it is possible that I need to add a "Requery" to the code to ensure that the form's records are in order.
    If that doesn't work I can use an ordinary recordset filtered by Truck No and do it that way.
     
  10. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
    A table supplies the form. I have a form with only the 5 fields . At the end of the day, I enter 15 to 20 records in the form; filling in the first 4 fields. The last field being the "TimeDifference" field. I then want to click a "Event Butn" which will run ie.. the code or the query to fill in all the blank "TimeDifference" fields. The records are sorted by "CarNo" and "TimeStopped". Therefore, CarNo 1 will be the 1st 8 records, CarNo 2 will be the next 5 records and finally CarNo 3 will be the last 7 records. The first record of each CarNo will always be zero (0) because there is nothing to subtract from that record. Hope I made sense of this.
    Gratefully Thankful,
    boaterjohn
     
  11. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
    OBP,
    I need to make a correction to the messg. I just sent you. A query does supply the form, NOT the table.
     
  12. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    The date needs to be in the sorting as well.
     
  13. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    However if you want I will just change the VBA to update all the records in the table that do not have the TimeDifference field filled in.
     
  14. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    But I will need a copy of the original table, it doesn't need any data in it.
     
  15. BoaterJohn

    BoaterJohn Thread Starter

    Joined:
    Aug 2, 2011
    Messages:
    116
    OBP,
    I will be zipping the small Access db. the one table, one form, and 2queries
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1090939

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice