Results 1 to 5 of 5
  1. #1
    archie1_za is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2017
    Posts
    48

    Calculating multiple date fields based on value of preceding field

    Hi



    I hope someone can help me with the following:

    1. I have an invoice date that is stored in an invoice table:

    2. There are 5 different tasks that need to be completed. Each Task has 3 date fields - In a TASK table

    Task1 has a :
    • Basedate that is determined by the invoice date + 5 Days (Locked - User cannot change)
    • PlannedCompletionDate = BaseDate +1 (Locked - User cannot change)
    • ActualCompletionDate = ( User Input)


    Task2 has a :

    • Basedate that is determined by the Task1:BaseDate + 1 Days (Locked - User cannot change)
    • PlannedCompletionDate = Task1:ActualCompletionDate +1 (Locked - User cannot change)
    • ActualCompletionDate = ( User Input)


    Task3 has a :

    • Basedate that is determined by the Task2:BaseDate + 1 Days (Locked - User cannot change)
    • PlannedCompletionDate = Task2:ActualCompletionDate +1 (Locked - User cannot change)
    • ActualCompletionDate = ( User Input)



    .... and so on.. for all 5 tasks

    For Each Task as well I need to have the following status' in a status field - please ignore syntax...

    IF Planned <= BaseDate THEN " In Progress"
    IF Planned > Basedate THEN "Delayed"
    IF Actual <> " Completed"

    Also a number of days delayed field ..lets call it Delayed
    = difference between BaseDate & Actual Date. (This will either return a -'ve number if its within time or a +'ve number if its delayed by how many days.


    All that the user needs to capture via a form is the actual completion date per task which is the only field i will have in the table??
    The rest of the fields can be created on the fly via a query. I understand that in the "Criteria" field in a query its not advisable to use a "created" field name .....

    I think I would be able to this with a query ontop of a query ontop of a query...etc... but that just seems cumbersome

    to give you an idea ... there are 40 units that each have 5 tasks which in turn have 3 dates each!!!!

    Is there an easier way? Any advice would be welcome.

    Thanking you in advance

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    a record cannot see the records around it.
    you can see all fields of the current record but not the ones ahead or behind.

    you would need code to scan the entire recordset,
    save the current record values,
    move to the next record then perform a function.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    I recommend you build a data model based on your business description. We do not know the details of your business. But it appears you have 5 Task types, each with specific attributes. You mention 40 units but we have no idea what a unit is.
    Also, you might consider using Projects for your work that involves Tasks. If Project contains 4 tasks, a Task could be complete , yet the Project still incomplete.

    Readers need more details to offer more focused advice.

    You should have a clear set of requirements that you understand before starting to build your physical database.

    Good luck.

  4. #4
    archie1_za is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Oct 2017
    Posts
    48
    @Orange - Thank You for the reply

    Currently in an Excel Spreadsheet it is listed as follows:

    |Invoice Date | Task 1 |Task 2 |Task 3 |Task 4 |Task 5 |

    These 5 tasks make up one section of a workflow - a unit - but we can refer to it as one table.

    Each Task field is a date field and currently only captures the completed date.

    What is required is the following:

    Survey Table
    |Invoice Date |
    | Task 1 Planned Start = Invoice date +5|Task 1 Planned Complete = Planned Start + 1 |Task 1 Actual Complete |Task 1 Status |Task 1 Days Delayed |
    | Task 2 Planned Start = Task 1 Planned Start +1 |Task 2 Planned Complete = Task 1 Actual Complete +1 |Task 2 Actual Complete |Task 2 Status |Task 2 Days Delayed |

    ...and so on until task 5


    Then The next Table/Unit/Section will start - i.e. Implementation Table - which has 5 tasks

    ...and so on...
    So the Survey Table will have only 5 static fields (actual completion date) and 20 calculated fields (from the query) fields if I calculate correctly.

    I have managed to complete the first part in a query (Survey Table) and got it to work as required. I wanted to inquire if there may be a simpler way of doing it as I will have to create 40 of the tables.

    I do apologise if I'm not explaining clearly but I am a complete novice in ACCESS.

    Thanking You Kindly.

  5. #5
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,043
    Hi,

    first thing to do is to let go of the Excel logic. Before you start a database design, perhaps take some time to study normalization (a lot of info there on the internet). As I look on it you only need 2 tables: tblSurvey and tblTasks.
    tblSurvey with fields like : ID (autonumber), InvoiceNumber (text or number), InvoiceDate (date)
    tblTasks with fields like : ID (autonumber), SurveyID (long integer), TaskNumber (integer) ActualStartDate (date), DateCompleted (date)

    linked on tblSurvey.ID = tblTask.SurveyID

    In your example the planned startdate for a task can be calculated as tblSurvey .Invoicedate + 5 + tbltasks.Tasknumber.

    Kind regards
    Noëlla

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

Similar Threads

  1. Replies: 4
    Last Post: 02-19-2016, 02:52 PM
  2. Replies: 1
    Last Post: 09-27-2013, 09:44 AM
  3. Replies: 3
    Last Post: 04-24-2013, 10:44 AM
  4. Replies: 12
    Last Post: 05-07-2012, 12:41 PM
  5. Combo Box values based on preceding selection
    By speckytwat in forum Access
    Replies: 11
    Last Post: 04-27-2011, 11:35 AM

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