Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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. OP
    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. OP
    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. OP
    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. OP
    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!)
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page