Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    3

    Field gets data from Expression?

    Is it possible to have a Field that contains data that is the product of a calculation?

    Thats to say the field Automatcally performs its own calculation to detremine it's own data?

    IE I have a field called Approximate Age of Animal and another called Date Entered into System. Using these Two I can Calculate its current age. (done so in a form) BUT what happens if the user wants to Run a Query on this Current Age? I also have an empty field called Current Age.



    It seems to be more of a spreadsheet thing. But Isnt there a way to do it in Access? it must happen allthe time?

    I have a splash screen at start I can Put code into at start up with VB but surley theres a more elegeant solution?

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275

    Re: Field gets data from Expression?

    Quote Originally Posted by Willot
    Is it possible to have a Field that contains data that is the product of a calculation?
    One of the core principles of good db design is that you never, ever, ever store calculated or derived values in a table. Anything that needs to be calculated relying on one or more element in the db already should not have a place in a table.

  3. #3
    Join Date
    Dec 2005
    Posts
    3
    mmm ok. Is there a way of performing a query on a derived value then?

  4. #4
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Sure. Lets say your Animals table has a DOB field. If you need to get a list of current animals' ages as of today:

    SELECT AnimalID, ((Now() - DOB) / 365) AS AnimalAge
    FROM Animals

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

Similar Threads

  1. Replies: 3
    Last Post: 10-30-2013, 11:42 AM
  2. Data won't show up in table field
    By texzen123 in forum Forms
    Replies: 3
    Last Post: 11-26-2009, 11:20 AM
  3. Replies: 1
    Last Post: 08-04-2008, 03:30 AM
  4. Expression Builder
    By mistaken_myst in forum Access
    Replies: 2
    Last Post: 05-07-2008, 01:30 PM
  5. Replies: 1
    Last Post: 03-02-2006, 06:17 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