Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Lawrence, Kansas, USA
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Expression Builder and Queries (Access2002)

    Hi,

    I only know how to do a very few things in Access, so any help and advice will be greatly appreciated. I have built query to find certain subsets of my data. Now I'm trying to use the expression builder.

    The data looks like this:
    Company Employee Amount
    XXX..........Smith.........10
    XXX..........Jack...........5
    YYY.........Wilson........1
    YYY.........Smith.........2

    I would like the query to find the Smith who works for YYY.

    In the design view of the query I put "Smith" in the criteria for Employee and YYY in the criteria for Company. When I do this I get both Smith's.

    I tried to use the expression builder using and instead of or, but I keep getting syntax errors if I try to do anything complex. In the help files, for the expression builder it says that you should always have an = sign, but in the examples under the query section of help there is no equal sign. This task shouldn't be this hard to figure out!

    <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>

  2. #2
    New Lounger
    Join Date
    Jun 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression Builder and Queries (Access2002)

    Paste this in the criteria of your query. Just change the the table name.

    <table1>![Employee]="Smith" And <table1>![Company]="yyyy"

    Hope this helps

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

    Re: Expression Builder and Queries (Access2002)

    The way to create "AND" criteria in the query design grid is to put criteria in the same row, and the way to create "OR" criteria is to put them in different rows. For complex criteria, you can combine them.

    If you want to specify that a field is equal to a certain value, you may, but are not obliged to use = in front of the value. The result of ="Smith" and of "Smith" is the same.
    Attached Images Attached Images
    • File Type: png x.png (4.1 KB, 0 views)

  4. #4
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Lawrence, Kansas, USA
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Expression Builder and Queries (Access2002)

    Thanks to both of you. Works like a charm. I figured it should be easy once I knew the secret handshake.

Posting Permissions

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