Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculating a date (Office 97 / Office XP)

    Can someone help me please. I want to add to my database /form /reports a calculation. I've never done that before and I'm slightly at a loss as how to start. I have created the table. One field is called StartDate, the next field is called Length in Months. What I would like to do is somehow calculate the "Ending" date based on the start date and length and be able to put it on a form or report. I'm sure this would be very simple for most of you, but right now, this old mind is blank! Thanks.
    Louise

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Calculating a date (Office 97 / Office XP)

    Use the DateAdd function.
    Charlotte

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Calculating a date (Office 97 / Office XP)

    Hi Louise,
    Add a textbox to your form/report and set its controlsource to:
    =dateadd("m",[Length in Months],[StartDate])
    and it should calculate your date for you.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Florida, USA
    Posts
    394
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculating a date (Office 97 / Office XP)

    It worked! Thank you very much!
    Louise

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calculating a date (Office 97 / Office XP)

    I see that you already have the answer as to how to calculate the date that you want. I would like to add one caution. You said that you wanted to "add to my database ..." the calculated date. If by that you meant that you want to add this in a field in a table, then you really should not do that. It is very bad practice to have a field in a table that is calculated from other fields in the database. That is because if someone goes into the database in table mode and changes the value in one of the fields that the calculated field is dependant on and doesn't change the calculate field, then the database is incorrect. You should always do the calculation in a query when you are extracting the data from the tables, or in the form or report.
    Legare Coleman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •