Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    15

    Unanswered: calculations in queries

    I have calculated age in a field in my database. I am now trying to use this calculation as part of a query. I have typed in the following calculation in the field row of the query design view:

    =DateDiff("yyyy",[D/O/B],now())+Int(format(now(),"mmdd")<format([D/O/B],"mmdd"))

    This is exactly the formula that works in the database form but in the when i go to view the results of the query i get the following message

    Syntax error (comma) in query expression '[Personal Details].[DateDiff("yyyy",[D/O/B],now())+Int(format(now(),"mmdd")<format([D/O/B],"mmdd"))]

    Can somebody please help me

    Cheers

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Assuming want to retur the calculated age in the query then try

    AgeateDiff("yyyy",[D/O/B],now())+Int(format(now(),"mmdd")<format([D/O/B],"mmdd"))

    Age will be the name of the field in the query (provided it does not currently exist).

    Hope this helps

    MTB

Posting Permissions

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