Results 1 to 9 of 9
  1. #1
    DebRogers is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    4

    Question Data calculation

    Hi. Thanks for reading my post.
    I have a field called IssueDate and another field called ExpiryDate


    I need the Expiry date field to look at the date in the IssueDate field, then add six months minus 1 day. The Expiry date is 6 months minus 1 day.
    I have the ExpiryDate filed set to a calculated field
    When I type DateAdd("m",+6,[IssueDate]) - I get an error message that says The expression dateAdd cannot be used in a calculated column.
    So, I have two questions.
    1. What type of column do I need the ExpiryDate to be
    2. What is the formula I need to add 6 months minus 1 day.

    I am using Access 2016 on Windows

    Thanks for your help.

    Deb

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    =DateAdd("d", -1 , DateAdd("m",6, [IssueDate]))

  3. #3
    DebRogers is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    4

    Thank you for the amazing formula. When I type it in the expression field I get the error message the the expression cannot be used in a calculated column. Is there a type of column/field I need to use in the table. This is a table - not a query... Thanks again

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    I have the ExpiryDate filed set to a calculated field
    the message is clear, you cannot use the DateAdd function in a calculated field. Calculated fields have limited capabilities and can only use a very few functions. It is not recommended to use them, but simply apply the formula in a query whenever it is required.

    What type of column do I need the ExpiryDate to be
    on the basis that the expiry date is always 6 months less a day, you don't need a field

  5. #5
    DebRogers is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    4
    Okay - thank you for your input. I will need to figure out a different way to do what I need to do. It is a medical form that is being produced from my table. The form needs to show the issue date and the expiry date based on this calculation. I can made the formula work in a query, so thank you for that. I just need to figure out how to show the calculated date on the form...

  6. #6
    DebRogers is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2018
    Posts
    4
    okay - I've got it figured out! Thanks everyone!

  7. #7
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    DebRogers - can you explain how you accomplished this? I am wanting to do a similar field, except mine [Date2] will be based on adding 2 years to [Date1]. Did you use a calculated field in a Query, or where you able to do it in the table or form?

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Quote Originally Posted by MSAccessOldTimer View Post
    DebRogers - can you explain how you accomplished this? I am wanting to do a similar field, except mine [Date2] will be based on adding 2 years to [Date1]. Did you use a calculated field in a Query, or where you able to do it in the table or form?
    Use the calculation in the query that is the forms record source.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    MSAccessOldTimer is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    46
    Thanks for your quick reply. And for your answer. I will do the same.

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

Similar Threads

  1. Select Data from Table for calculation
    By Erictsang in forum Queries
    Replies: 8
    Last Post: 09-24-2017, 07:49 AM
  2. Data calculation
    By harry26 in forum Access
    Replies: 2
    Last Post: 02-12-2015, 01:32 PM
  3. Calculation using Table Data
    By scoobz1234 in forum Access
    Replies: 22
    Last Post: 04-12-2013, 12:31 PM
  4. Data variance calculation report
    By O2BSmart in forum Access
    Replies: 4
    Last Post: 08-10-2010, 09:35 AM
  5. Data calculation between records
    By ibergarden in forum Access
    Replies: 3
    Last Post: 04-22-2010, 11:39 AM

Tags for this Thread

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