Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Query: Get Value from table (2003)

    Good day mates,

    In a query I want only to show up records from a specific year. Now what I tried is to put this as the criteria:

    =DLookup("Value", "tblSys", "Title = 'Set Year'")

    but Access tells me that this is syntactically wrong and I'm missing some operator... Maybe you guys can help me out.

    So what I basically want (if you don't get it by the DLookup) is that Access only shows me records which have the same Year as set in tblSys:Value> Set Year

    Thanks in advance
    Dennis

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Query: Get Value from table (2003)

    No, I don't get it. This is what your DLookup says: retrieve the field named Value from an arbitrary record in tblSys for which the field named Title contains the text "Set Year". <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  3. #3
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query: Get Value from table (2003)

    Well what I want is this: Read out the specific data in Set Year.

    So when the data in Set Year says 2004, only 2004 records should be returned...
    look at the tbl sample picture

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Query: Get Value from table (2003)

    Do you use a comma as decimal separator? If so, you probably use a semicolon as list separator, and that is what the expression expects:

    <code>DLookUp("Value";"tblSys";"Title = 'Set Year'")</code>

  5. #5
    Star Lounger
    Join Date
    Apr 2002
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query: Get Value from table (2003)

    I think you're missing some brackets. Try:

    =DLookup("[Value]", "tblSys", "[Title] = 'Set Year'")

  6. #6
    2 Star Lounger
    Join Date
    Jun 2004
    Location
    L, Schleswig-Holstein, Germany
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Query: Get Value from table (2003)

    Yeah the semicolon did the trick, thanks!

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Query: Get Value from table (2003)

    You must distinguish between working in the user interface (for example, creating a query in design mode) and in VBA/SQL. In the user interface, you must use your localized settings for numbers and dates; in VBA and in SQL, you must use USA number and date formats.

Posting Permissions

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