Results 1 to 5 of 5
  1. #1
    challenger is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    6

    lap Counter

    I need a counter in my database that can do the following

    I nput the number of laps the car has done . The next day I put in the number of laps the car has done and it displays the total number for the 2 days . Same for day 3 day 4 etc .
    at the end of the week or 2 weeks or 10 days etc I want to reset the total counter to zero .
    This sound simple and probably is but it is causing me a lot of grief .
    I know access isn't the best program to do this but I want to avoid ( and need to ) using something like Excel .



    Can somebody help or point me in the right direction

    rgds Callenger

  2. #2
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Make two tables

    Table 1: tblLaps
    LapID: AutoNumber, Primary Key
    GroupID: Integer, Index
    LapDate: Short Date
    LapQty: Integer

    Table 2: tblLapGroup
    LGID: AutoNumber, Primary Key

    Foreign Key: tblLaps.GroupID = tblLapGroup.LGID

    Each day, you add a Record to tblLaps. When you're done with the week (or whatever), just increment your LapGroup.LGID field.

    This allows you to use different timeframes (it doesn't have to ALWAYS be exactly a week) and keep all the old data (for comparisons, trend analysis, etc.). You can also add fields to tblLapGroup for things like comments.

  3. #3
    challenger is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    6
    Thanks RaWb for the reply but I think I haven't explained it properly

    My problem is that after I have added the lap count to a car I want to set that cars lap count to zero . Then when it has fnished add that lap count to the previous count . I want to do this until I do an engine change and then I will have a total count of the laps that engine has done .

    This maybe a short time or a long time and I don't need to keep a record of all individual lap count just get a total at the end when an engine is changed

    My problem is how do I add a lap count to a previous total and then use the new total for the next time after a new lap count is to be added

    Hope this is more clear

    Thanks

  4. #4
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    OK then, let's try making the following change to my Table setup:

    Table 1: tblLaps
    LapID: AutoNumber, Primary Key
    LapEngineID: Integer, Index
    LapDate: Short Date
    LapQty: Integer

    Table 2: REMOVE

    If you have serial/part numbers on the engines that change each time you replace one, you can use that instead of just a random number. Change LapEngineID from "Integer" to "Text".

    Then, to sum up the laps run using a certain engine, use the following Query:

    Code:
    SELECT SUM([LapQty]) FROM tblLaps WHERE [LapEngineID]=<current engine ID number>
    Be sure to change the bolded text to the ID number of the engine you're looking at.

    Every time you change the engine, you'll change the Engine ID so your lap count will reset for you automatically.

    Note: If you're only ever going to be tracking a single car (and don't care about the driver), this setup will work just fine. If you plan on eventually tracking multiple car/driver/engine combinations however, you'd be better off with a more complex setup that has that capability built in from the start.

  5. #5
    challenger is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    6
    Thanks Rawb for all the help

    much appreciated

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

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