Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Access Database Default value problem

SjbpSjbp Member Posts: 3
I'm currently working on a Access database which will store data about different packaging lines. The thing is that there are 3 shifts in a working day and each one has a different time period (510 minutes, 480 minutes, etc). The client also wants the flexibility to change the duration of the shifts without changing the historical data... This is my problem. I don't know how to give them that tool without changing the old data. I'd tried VB code, but still doesn't work. PLease!! I need help!!!

Comments

  • gizzugizzu Member Posts: 42
    : I'm currently working on a Access database which will store data about different packaging lines. The thing is that there are 3 shifts in a working day and each one has a different time period (510 minutes, 480 minutes, etc). The client also wants the flexibility to change the duration of the shifts without changing the historical data... This is my problem. I don't know how to give them that tool without changing the old data. I'd tried VB code, but still doesn't work. PLease!! I need help!!!
    :


    Maybe you should think about having one table storing the default shift times, and one table storing historical data about the shifts, that means if your client wants to change the duration of the shifts, just have a form for the standard times table, and for each new day, have some VB (or better, SQL) code inserting the standard shift times into the historical, adding the current date. So, you have both correct historical data and flexibility. That means table "shifts_standard" would look like this:

    ID (counter) | from_t | until_t
    1 1980-01-01 11:05 AM 1980-01-01 17:15 PM
    2 1980-01-01 05:15 PM 1980-01-02 01:30 AM
    ...and so on. The table "shifts_history" would look like:
    ID (counter) | from_time | until_time
    1 2004-03-26 11:05 AM 2004-03-26 17:15 PM
    2 2004-03-26 05:15 PM 2004-03-27 01:30 AM
    ...if your client wants to change the duration of the shifts, he just changes the shifts_standard table. For each new day, run this SQL code:

    INSERT INTO shifts_history (from_time, until_time)
    SELECT DateAdd('d', DateDiff('d', '1980-01-01', Now()), from_t) AS from_time, DateAdd('d', DateDiff('d', '1980-01-01', Now()), until_t) AS until_time FROM shifts_standard;

    Optionally, you can replace the Now() function with a date inserted by VB code, so you can write the data to the database even if you are a few days late.

    If it doesn't work, or if you need more help, just reply back.

    Hope that helped.

    //gizzu

  • gizzugizzu Member Posts: 42
    : I'm currently working on a Access database which will store data about different packaging lines. The thing is that there are 3 shifts in a working day and each one has a different time period (510 minutes, 480 minutes, etc). The client also wants the flexibility to change the duration of the shifts without changing the historical data... This is my problem. I don't know how to give them that tool without changing the old data. I'd tried VB code, but still doesn't work. PLease!! I need help!!!
    :

    Maybe I didn't understood you right in my last reply. If this is the case, please reply.


    //gizzu

  • SjbpSjbp Member Posts: 3
    : : I'm currently working on a Access database which will store data about different packaging lines. The thing is that there are 3 shifts in a working day and each one has a different time period (510 minutes, 480 minutes, etc). The client also wants the flexibility to change the duration of the shifts without changing the historical data... This is my problem. I don't know how to give them that tool without changing the old data. I'd tried VB code, but still doesn't work. PLease!! I need help!!!
    : :
    :
    : Maybe I didn't understood you right in my last reply. If this is the case, please reply.
    :
    :
    : //gizzu
    :
    :
    Don't worry, I believe it will work Thanks!!
  • moniksingsmoniksings Member Posts: 2
    : : I'm currently working on a Access database which will store data about different packaging lines. The thing is that there are 3 shifts in a working day and each one has a different time period (510 minutes, 480 minutes, etc). The client also wants the flexibility to change the duration of the shifts without changing the historical data... This is my problem. I don't know how to give them that tool without changing the old data. I'd tried VB code, but still doesn't work. PLease!! I need help!!!
    : :
    :
    : Maybe I didn't understood you right in my last reply. If this is the
    : case, please reply.
    :
    :
    : //gizzu
    :
    :








    ^_^

Sign In or Register to comment.