| Feedback | Using Access Queries | |
A database may contain data which is to be reported and shared with users in another application such as a web page. There might be a requirement to routinely save a series of charts as GIF or PNG image files.
In the following example, there is a table which contains the reasons given for requesting a Finance department to raise credit notes. These are analysed for each department within a hospital. The intention is to generate an individual pie chart for each department and then export and save the images.
A query can contain the sales ledger transaction details and links them to another table containing department names. The process uses a table (called Keydata) containing program variables in order to set a parameter of a particular department name.
A simple form has been created containing a pie chart with the data for the current department.
|
|
The form containing the chart requires a couple of bits of VBA code linked to property events. The first timer event automatically closes the form after a short time. The second program exports the chart to a file when the form is closed / unloaded.
Private Sub Form_Timer() |
Private Sub Form_Unload(Cancel As Integer) |
A user defined function called LUKeyData() in the second program returns the name of the department.
A macro or VBA instruction on another form can call and open this first form repeatedly to generate and export a series of charts.
Private Sub BtnOpenFrm_Click() |
The chart image files are now available to be incorporated in other web pages.
|
|
file: Acc_Chart_Export.htm | © meadinkent.co.uk 2015 | Page updated Aug 15 |