List box and Button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi.
I have created a query named "Existing MIS Query" that pulls information
from the "Survey" Table. Usually we want the information compiled by month so
i added [Enter Month:] As the criteria for the query. Is there a way that
instead of typing in the month every time i want to perform the quert, I can
choose from a list box?

I have a created a list box from a table called "Month". This listis all of
the months of the year and is stored in the "Survey" Table.

Thanks in advance!
-Rich
 
I don't understand the part about "stored in the Survey table". Are you
filling the listbox Row Source with months that exist in the Survey table?
If so, that would be a common way to do this.

To get the listbox to work as your criteria, the form that has the listbox
will need to be open (hidden or visible) with a selection made in the
listbox. Change the parameter from [Enter Month] to
[Forms]![frmFormName]![lstListboxName]. Once this is done, the query will
pull the value from the listbox.

If you want to select more than one month by using a multiselect listbox,
this can be done also, but requires more work. The above will only work for
a single select listbox.
 
Thanks Wayne.

Does this keep me from adding further criteria to the query??
I have another filed that is called "Survey Status" that is linked to the
Customer List Table. I want it to only show "survey performed" (which is one
of the list choices) but it wont let me / or I am doing it wrong.

Regards
-Rich





Wayne Morgan said:
I don't understand the part about "stored in the Survey table". Are you
filling the listbox Row Source with months that exist in the Survey table?
If so, that would be a common way to do this.

To get the listbox to work as your criteria, the form that has the listbox
will need to be open (hidden or visible) with a selection made in the
listbox. Change the parameter from [Enter Month] to
[Forms]![frmFormName]![lstListboxName]. Once this is done, the query will
pull the value from the listbox.

If you want to select more than one month by using a multiselect listbox,
this can be done also, but requires more work. The above will only work for
a single select listbox.

--
Wayne Morgan
MS Access MVP


Rich said:
Hi.
I have created a query named "Existing MIS Query" that pulls information
from the "Survey" Table. Usually we want the information compiled by month
so
i added [Enter Month:] As the criteria for the query. Is there a way that
instead of typing in the month every time i want to perform the quert, I
can
choose from a list box?

I have a created a list box from a table called "Month". This listis all
of
the months of the year and is stored in the "Survey" Table.
 
No, this shouldn't prevent you from having other criteria in the query on
other fields. You could even have other criteria on this field using an Or
or And statement in the criteria. Post the SQL view (copy and paste) of your
query into a message.
 
Back
Top