Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Queries _ Query Criteria Vs List Box Criteria

Posted by: RAZMaddaz Sep 19 2019, 04:06 PM

Hi Everyone,

Let's say that I have a query with criteria, with some of the criteria already entered. Now if I create a list box used to filter the query, shouldn't the list box have the same criteria already entered too?

I assume yes, but I would like to hear back from this AWESOME web site, with someone's opinion.

Thank you!

RAZMaddaz

Posted by: tina t Sep 19 2019, 04:41 PM

QUOTE
Now if I create a list box used to filter the query, shouldn't the list box have the same criteria already entered too?

well, it depends. a listbox could have absolutely nothing to do with a query dataset, except that the listbox presents some instances of a datapoint that is included in the query too.

or maybe i misunderstand the question. could you provide an example? or maybe the query SQL statement, and listbox RowSource?

hth
tina

Posted by: RAZMaddaz Sep 19 2019, 05:46 PM

Well, if I have a query used for sub-queries and let's say it has criteria and it returns 40 records, then shouldn't this list box have the same criteria so it starts with the same 40 records?

Otherwise the list box will show more records to chose from and if the User selects one of those records, the query wil return blank, which I understand why, but I don't want to confuse the User as why it shows in the list box but returns no data.

You follow me, or am I just going crazy? laugh.gif

Thanks!

RAZMaddaz

Posted by: Jeff B. Sep 19 2019, 06:12 PM

Your query 'feeding' the listbox has criteria. Are those part of the query (e.g., WHERE [YourField] > 3) and/or are the criteria of the 'parameter' variety (e.g., the query includes a selection criterion of something like [Enter Your Criterion Here])?

And after the query 'feeds' the listbox, wouldn't the listbox contain the results of the query (e.g., the records selected)? So how are you envisioning the listbox containing the "criteria"?

or are you saying you want to modify the selection criteria so the listbox lists DIFFERENT records?

More info, please...

Posted by: tina t Sep 19 2019, 07:12 PM

QUOTE
Well, if I have a query used for sub-queries and let's say it has criteria and it returns 40 records, then shouldn't this list box have the same criteria so it starts with the same 40 records?

if you want the listbox RowSource to return the same dataset as the query, then yes, i'd say it should have the same criteria as the query. you're using the listbox to navigate between, or choose, specific records in the subform based on the query, is that correct?

hth
tina

Posted by: RAZMaddaz Sep 19 2019, 08:00 PM

Tina, what you said is 100% correct.

John, you are correct, too.

I wish I could explain everything, but you both helped me and I don't want to waste anymore of your time.

Thank you! thumbup.gif

RAZMaddaz

Posted by: tina t Sep 20 2019, 01:51 PM

you're welcome, RAZ, we're both glad to help. :) tina