Change query parameters?

justice8965

Registered User.
Local time
Today, 08:20
Joined
Aug 25, 2009
Messages
32
Hey all, having some trouble figuring out the best way to do this.

I have a query that is based on an ID number which is in a ComboBox on a form. Basically the user selects the ID, then the query is run based on that ID (the query pulls up their energy usage for the most recent 12 months). The ComboBox contains all of the ID numbers of customers in our database.

What I'd like to do now is populate a table with a 12 month usage history for each client. So, take the 12 months for the first ID number, put it in the table, go to the next ID, repeat etc. until each number in the ComboBox has been used.

How would I go about stepping through the ComboBox and running the query on each number programmatically?
 
The immediate response to this is you can but really - dont

Firstly why do you want to make a table ?

To open the query parameters
If its just a normal query copy and rename it
Get rid of the parameter in the ID column that says something like Forms!FormName!Combobox
Now your query should pull all the data for the ID's in the table

Look up the insert Into sql examples to push a query to a table - I really dont suggest this though - you will fill up the db
 
I need this in a table for several business applications.

Removing the ID parameter won't work because once the query is run, I'm doing several calculations in code based off the query and putting the results into the table. Each ID needs to be done separately from the rest because of how the calculations work.

Is there no simple way to just run the query on the first ID in the ComboBox, do the calculations, put it in the table then go to the next item in the ComboBox? This would be simple if I knew of a way to move through a combobox...
 
I need this in a table for several business applications.

Removing the ID parameter won't work because once the query is run, I'm doing several calculations in code based off the query and putting the results into the table. Each ID needs to be done separately from the rest because of how the calculations work.

Is there no simple way to just run the query on the first ID in the ComboBox, do the calculations, put it in the table then go to the next item in the ComboBox? This would be simple if I knew of a way to move through a combobox...
 

Users who are viewing this thread

Back
Top Bottom