Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Parameter Query

Discussion in 'Information Technology' started by Rich D, Jul 28, 2006.

  1. Rich D

    Rich D
    Expand Collapse
    Guest

    Can I do a parameter query where the query returns based on the entered
    parameter being found in any of 4 different fields? I have a subcontractor
    table and for each sub I have 4 (more later) fields with that subs various
    jobs. I want to query for only thos subs who are working on the [Martin]
    job, for example. martin could be listed in any of the 4 fields.
    --
    Rich D
    Armstrong Custom Homes
    Redmond
     
  2. Loading...


  3. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Mon, 17 Jul 2006 13:20:03 -0700, Rich D
    <RichD@discussions.microsoft.com> wrote:

    >Can I do a parameter query where the query returns based on the entered
    >parameter being found in any of 4 different fields? I have a subcontractor
    >table and for each sub I have 4 (more later) fields with that subs various
    >jobs. I want to query for only thos subs who are working on the [Martin]
    >job, for example. martin could be listed in any of the 4 fields.


    Sure. Just put the parameter under each of these fields, ON SEPARATE
    LINES of the query grid. This will use OR logic to search all four
    fields and return the record if any one of them matches.

    John W. Vinson[MVP]
     
  4. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    You can, but be aware that a need to do so generally indicates that the
    database hasn't been properly normalized.

    Your WHERE clause would look like WHERE Field1 = [Parameter] Or Field2 =
    [Parameter] Or Field3 = [Parameter] Or Field4 = [Parameter]. Make sure you
    spell the parameter name identically in all 4 cases.

    In the GUI query builder, you'd put the parameter on separate lines under
    the 4 fields. If there are additional elements in the WHERE clause, you'd
    have to repeat those conditions on all 4 lines.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no private e-mails, please)


    "Rich D" <RichD@discussions.microsoft.com> wrote in message
    news:5F7788FA-B02C-4EF1-88CE-9CD6239CC32E@microsoft.com...
    > Can I do a parameter query where the query returns based on the entered
    > parameter being found in any of 4 different fields? I have a
    > subcontractor
    > table and for each sub I have 4 (more later) fields with that subs various
    > jobs. I want to query for only thos subs who are working on the [Martin]
    > job, for example. martin could be listed in any of the 4 fields.
    > --
    > Rich D
    > Armstrong Custom Homes
    > Redmond
     
  5. Jamie Collins

    Jamie Collins
    Expand Collapse
    Guest

    Douglas J. Steele wrote:
    > Your WHERE clause would look like WHERE Field1 = [Parameter] Or Field2 =
    > [Parameter] Or Field3 = [Parameter] Or Field4 = [Parameter]. Make sure you
    > spell the parameter name identically in all 4 cases.


    Alternatively (particularly if typing the parameter name is an issue
    <g>):

    WHERE [Parameter] IN (Field1, Field2, Field3)

    Jamie.

    --
     
  6. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    "Jamie Collins" <jamiecollins@xsmail.com> wrote in message
    news:1153226755.625414.283790@35g2000cwc.googlegroups.com...
    >
    > Douglas J. Steele wrote:
    > > Your WHERE clause would look like WHERE Field1 = [Parameter] Or Field2 =
    > > [Parameter] Or Field3 = [Parameter] Or Field4 = [Parameter]. Make sure

    you
    > > spell the parameter name identically in all 4 cases.

    >
    > Alternatively (particularly if typing the parameter name is an issue
    > <g>):
    >
    > WHERE [Parameter] IN (Field1, Field2, Field3)



    Clever!

    What about field 4 though? <g>

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)
     

Share This Page