Forum Home
Press F1
 
Thread ID: 54718 2005-02-20 08:52:00 MS Access Query kiwiwulf (7380) Press F1
Post ID Timestamp Content User
326807 2005-02-20 08:52:00 Looking for an example of a multiselect listbox which can then be passed to a query. :confused: kiwiwulf (7380)
326808 2005-02-20 09:06:00 Do a google
multiselect listbox which can then be passed to a query
heaps there
bartsdadhomer (80)
326809 2005-02-20 19:42:00 Hi
I'm not sure if you mean a combo box when you say "multiselect listbox". If you are referring to a combo box on a form (i.e. a drop down list) then in your form design assign the combo box a meaningful name (Right click the combo box -> Properties -> Name). In your query design go to the field that you want the data passed through to, from the combo box on the form, and enter the following into the criteria section :

[Forms]![Your_Form_Name]![Your_Combo_Box_Field_Name]

but replace the form name and combo box names with your actual form and combo box names. If this is not quite what you are after, post a reply.
HTH, Andrew
andrew93 (249)
326810 2005-02-22 09:15:00 What I have is a database (ongoing development as things come to mind) I use to track my cycle training and expenses. Fairly simple but as I track 3 bikes producing reports specific to a bike can be a hassle.
I drag out data for each bike with a query but seems that being able to select the appropriate criteria from a list which is then passed to a query would make things simple. Also selecting a date range would help. Really must archive the old data. :groan:
kiwiwulf (7380)
326811 2005-02-22 09:36:00 If you have a form in place, then my previous suggestion still stands - you can reference the fields on the form in the criteria of the query as follows :

Criteria for the [bike] field in the query :
[Forms]![Your_Form_Name]![Your_Bike_Combo_Box_Name]

You will need a button on the form to open the query for this to work - even better it could open a form or a report based on the query that would display the data in a nicer format.

Alternatively if you are not using a form, you could select the bike "on the fly" by using this criteria instead :
[Enter the bike number]
And you will get prompted for the bike number (1, 2 or 3 perhaps?) when you open / run the query.

In the same query under the [date] field enter either of the following as your crtieria (depending on whether or not you are using a form and if you want the data from "a" to "b" of just from "a" to now)

Form based solution (query date criteria) :
either
>=[Forms]![Your_Form_Name]![Your_First_Date_Field]
or
>= [Forms]![Your_Form_Name]![Your_First_Date_Field] and <= [Forms]![Your_Form_Name]![Your_Last_Date_Field]

No form solution :
either
>=[Enter the from date]
or
>= [Enter the from date] and <= [Enter the end date]

HTH, Andrew
andrew93 (249)
1