RE: query criteria entered via a form
- From: "Lori" <Lori@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 04:27:32 -0800
It worked!!!! Thank-you so much for your help and patience!!! Lori
"Ofer" wrote:
> Try if this give you the resault you are looking for
>
> SELECT tbl_Vendor.Vendor_Nbr, tbl_Vendor.Vendor_Name,
> tbl_Vendor.Chain_Suffix, tbl_Vendor.Region_Code, tbl_Vendor.Status_Code
> FROM tbl_Vendor
> WHERE (tbl_Vendor.Chain_Suffix=[Forms]![frm_rpt_test]![Chain_Suffix] Or
> [Forms]![frm_rpt_test]![Chain_Suffix] Is Null) AND
> (tbl_Vendor.Region_Code=[Forms]![frm_rpt_test]![Region_Code] Or
> [Forms]![frm_rpt_test]![Region_Code] Is Null) AND
> (tbl_Vendor.Status_Code=[Forms]![frm_rpt_test]![Status_Code] Or
> [Forms]![frm_rpt_test]![Status_Code] Is Null)
>
> --
> \\// Live Long and Prosper \\//
> BS"D
>
>
> "Lori" wrote:
>
> > Here's the SQL - I used every possible combination - all 3 criteria with
> > values, each by itself, and each combination of only 2 criteria being
> > selected. Also, I was mistaken earlier - the only way the result is correct
> > is when I pick only one criteria from the form. Thanks for your help!
> >
> > SELECT tbl_Vendor.Vendor_Nbr, tbl_Vendor.Vendor_Name,
> > tbl_Vendor.Chain_Suffix, tbl_Vendor.Region_Code, tbl_Vendor.Status_Code
> > FROM tbl_Vendor
> > WHERE (((tbl_Vendor.Chain_Suffix)=[Forms]![frm_rpt_test]![Chain_Suffix]) AND
> > ((tbl_Vendor.Region_Code)=[Forms]![frm_rpt_test]![Region_Code]) AND
> > ((tbl_Vendor.Status_Code)=[Forms]![frm_rpt_test]![Status_Code])) OR
> > (((tbl_Vendor.Chain_Suffix)=[Forms]![frm_rpt_test]![Chain_Suffix]) AND
> > ((tbl_Vendor.Region_Code)=[Forms]![frm_rpt_test]![Region_Code])) OR
> > (((tbl_Vendor.Chain_Suffix)=[Forms]![frm_rpt_test]![Chain_Suffix]) AND
> > ((tbl_Vendor.Status_Code)=[Forms]![frm_rpt_test]![Status_Code])) OR
> > (((tbl_Vendor.Region_Code)=[Forms]![frm_rpt_test]![Region_Code]) AND
> > ((tbl_Vendor.Status_Code)=[Forms]![frm_rpt_test]![Status_Code])) OR
> > (((tbl_Vendor.Chain_Suffix)=[Forms]![frm_rpt_test]![Chain_Suffix])) OR
> > (((tbl_Vendor.Region_Code)=[Forms]![frm_rpt_test]![Region_Code])) OR
> > (((tbl_Vendor.Status_Code)=[Forms]![frm_rpt_test]![Status_Code]));
> >
> >
> > "Ofer" wrote:
> >
> > > can you post the SQL you have now?
> > >
> > > --
> > > \\// Live Long and Prosper \\//
> > > BS"D
> > >
> > >
> > > "Lori" wrote:
> > >
> > > > Hi,
> > > >
> > > > I got the two criteria to work. I have since added a third - I can get it
> > > > to work if I fill in only one field or all but not if I do 2 out of the
> > > > three. I need some way to represent a value not being selected from the 3rd
> > > > field. Any suggestions?
> > > >
> > > > "Ofer" wrote:
> > > >
> > > > > What happen when you run only "2" from the Region field, without the status?
> > > > >
> > > > > If it run correctly, it could be that the criteria you are looking for is OR
> > > > > and not AND as you have now.
> > > > > If that the case move the Region criteria one box under, or in SQL view
> > > > > change the AND to OR
> > > > >
> > > > >
> > > > > --
> > > > > \\// Live Long and Prosper \\//
> > > > > BS"D
> > > > >
> > > > >
> > > > > "Lori" wrote:
> > > > >
> > > > > > I am using Access 2002 and created an unbound form with a couple fields to be
> > > > > > used for search criteria to be selected on the fly to drive a query. I have
> > > > > > a field called Region and one called Status. I entered the form fields in
> > > > > > the query criteria but can only get the results to work using one selection
> > > > > > criteria at a time. How can I make the query run if both selection criteria
> > > > > > have a value selected from it?
> > > > > >
> > > > > > For example, if I select "active" from the status drop-down field on the
> > > > > > form, the query runs correctly. But if I select "active" from the status
> > > > > > field and "2" from the Region field - the results are inaccurate.
> > > > > >
> > > > > > Here is what I have in the query criteria: Under the Region field -
> > > > > > [Forms]![frm_rpt_test]![Region_Code] and under the Status field -
> > > > > > [Forms]![frm_rpt_test]![Status_Code]. I know I am not finding the right
> > > > > > combination or rows to place this data in the query design. Thanks!
.
- Follow-Ups:
- RE: query criteria entered via a form
- From: Ofer
- RE: query criteria entered via a form
- References:
- RE: query criteria entered via a form
- From: Lori
- RE: query criteria entered via a form
- From: Ofer
- RE: query criteria entered via a form
- Prev by Date: INNER JOINS in Access
- Next by Date: Re: creating custom parameter form
- Previous by thread: RE: query criteria entered via a form
- Next by thread: RE: query criteria entered via a form
- Index(es):
Relevant Pages
|
|