JeffBarker
Registered User.
- Local time
- Today, 07:50
- Joined
- Dec 7, 2010
- Messages
- 130
Hi guys, I've got a slight problem that I'm wondering if anyone will be able to help with.
I have a form that calculates the percentage of a product sold to customers.
The Main Form features two unbound text boxes you can select a date from and a date to, and an unbound combo box that looks up a list of products.
I then have a continuous SubForm that shows all the customers this product was sold to, how many units were sold to each customer and what percentage of the total amount their figure (sold) is.
The SubForm reads the criteria entered in the unbound date boxes and combo lookup on the Main Form using the following:
and
With a Search button on the Main Form that requeries the subform when you click it.
What I need to do is create a PieChart that shows the percentage of products sold per customer, but also updates when you click the Search button on the Main Form - so you can enter one set of criteria and view the results, then enter a new set of criteria etc and so on.
The PieChart wizard unfortunately only lets me use Tables or Queries as the DataSource for the PieChart so I'm thinking code would be the best way forward here.
I was toying with the idea of creating a new table to fuel the PieChart, which gets deleted and then replaced every time the Search button on the Main Form is clicked, but I'm struggling with the best way to do this - could anyone recommend a good slice of VBA to do the job, please?
Likewise, if anyone can think of a better alternative I'd be happy to consider that also.
Thanks in advance guys.
Jeff.
I have a form that calculates the percentage of a product sold to customers.
The Main Form features two unbound text boxes you can select a date from and a date to, and an unbound combo box that looks up a list of products.
I then have a continuous SubForm that shows all the customers this product was sold to, how many units were sold to each customer and what percentage of the total amount their figure (sold) is.
The SubForm reads the criteria entered in the unbound date boxes and combo lookup on the Main Form using the following:
Code:
=[forms]![myform]![cboLookup]
and
Code:
=[forms]![myform]![txtDateField]
With a Search button on the Main Form that requeries the subform when you click it.
What I need to do is create a PieChart that shows the percentage of products sold per customer, but also updates when you click the Search button on the Main Form - so you can enter one set of criteria and view the results, then enter a new set of criteria etc and so on.
The PieChart wizard unfortunately only lets me use Tables or Queries as the DataSource for the PieChart so I'm thinking code would be the best way forward here.
I was toying with the idea of creating a new table to fuel the PieChart, which gets deleted and then replaced every time the Search button on the Main Form is clicked, but I'm struggling with the best way to do this - could anyone recommend a good slice of VBA to do the job, please?
Likewise, if anyone can think of a better alternative I'd be happy to consider that also.
Thanks in advance guys.
Jeff.