Results 1 to 3 of 3
  1. #1
    JackieFeng is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Mar 2016
    Posts
    24

    Dateadd function

    In my booking table, i have starttime,duration and finishing time. I try to use dateadd function to calculate finishing time by adding my duration and starttime. I put =DateAdd("n","Duration","StartTime") into default value of finishing time field but when i saved table, it displayed an error message 'error type mismatch'.. What does it mean?

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I don't think you can store calculations as default values in a table.

    However, there is no need to. The general rule of thumb is to never store anything that can be calculated on-the-fly in a query. Doing so violates the rules of normalization, and can undermine data integrity and the dynamic nature of the database.

    Anything that you use a table for you can use a query for, so there is no need to store calculations, unless you are trying to make some sort of historical record of values at certain points in time.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    JackieFeng,

    Do NOT start a new thread. Your previous thread has all the info relevant to your situation

    https://www.accessforums.net/showthread.php?t=59613

    JoeM is telling you similar info, you don't need to store all 3 fields, and you shouldn't store calculated data.

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

Similar Threads

  1. used function DateAdd
    By azhar2006 in forum Queries
    Replies: 2
    Last Post: 10-07-2015, 03:31 PM
  2. DateAdd Function
    By armyofdux in forum Queries
    Replies: 12
    Last Post: 03-09-2015, 09:52 AM
  3. DateAdd Function
    By jschlapi in forum Forms
    Replies: 4
    Last Post: 10-23-2013, 01:36 PM
  4. DateAdd Function
    By Desstro in forum Programming
    Replies: 3
    Last Post: 04-03-2011, 01:45 PM
  5. Help Please - DateAdd Function
    By graviz in forum Queries
    Replies: 3
    Last Post: 03-02-2010, 02:34 PM

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