Results 1 to 4 of 4
  1. #1
    maarcmade is offline Novice
    Windows XP Access 2002
    Join Date
    May 2010
    Posts
    2

    Extract data from table instead of prompting in Query

    Hi,



    I have the following expression in Query to compute the age of a person,

    Age: DateDiff("yyyy",[DOB],Date())-IIf(Format([DOB],"mmdd")>Format(Date(),"mmdd"),1,0)

    but when query is executed, it prompt me to input the DOB. I already have a DOB in a table, I wish that instead of prompting me for the input, it gets the information from the table. Any idea how I should go about doing it. Thanks in advance for your advice.

    Best Regard
    Marc

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The table containing the DOB field would need to be in the FROM clause of the query (displayed at the top in design view).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    maarcmade is offline Novice
    Windows XP Access 2002
    Join Date
    May 2010
    Posts
    2
    Hi,

    Can you specified what you mean by "FROM clause of the query (displayed at the top in design view)", I'm abit confused. Thanks

    Quote Originally Posted by pbaldy View Post
    The table containing the DOB field would need to be in the FROM clause of the query (displayed at the top in design view).

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What table is your DOB field in, and what's the SQL of this query?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 05-13-2010, 10:50 AM
  2. Replies: 1
    Last Post: 02-02-2010, 07:19 AM
  3. Query to extract record of particular year
    By pkg206 in forum Access
    Replies: 2
    Last Post: 11-11-2009, 10:01 PM
  4. Replies: 3
    Last Post: 10-19-2009, 01:14 PM
  5. Replies: 0
    Last Post: 04-26-2008, 09:59 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