I have a chart in a form, and I would like to modify the legend, but when I do so in the datasheet, it doesn't memorize the modification once I go back to the form view.
Can someone help me?
You may have to requery the graph object. I have just tested this and found that once a form has been opened with a graph on it, the graph displays the information it finds in the underlying table at that time. If you then edit the data in the table the graph is not updated automatically.
I used a basic table with two columns, 'subject' (for the x-axis/legend(?))and 'value' (for the values). I changed values in both 'subject' and 'value' and the graph was not updated until I re-opened the form.
By using code similar to:
Code:
Me.[B]GraphControlName[/B].Requery
in a suitable event, or linked to a button on the form with the graph, you will be able to update the graph display.
If you want to automate the graph display update then you will need to make sure that the values are entered into a form (so that the code can be executed from it), rather than a basic table (which is not good practice as much of the control you could have over data is not available in a vanilla table), which can't execute code; you can, however, create a form that looks like a table, and can execute code .
I hope that this is what you meant by the legend not changing.
Alternatively, if you want to change the 'text' in the legend where the colours associated with the bars, for example, is. Right click on the graph, on the line where it says Row Source, click on the ... button. You should now be able to see the underlying query which the graph is using. If there is, for example, a Count column, which will probably have Count: Count(*) in it then you could change that to Totals: Count(*) and where the legend previously said 'Count' it would now say 'Totals'.