PDA

View Full Version : changing chart title using vba in access



lucky245
07-28-2010, 07:59 AM
I have a chart in a form in Msaccess XP. The user can choose which group he wishes to see the results on. I have everything working including the charts dynamically changing however for the icing on the cake it would be nice to change the title to include the current group that the chart is related to, dependant on a combo box selection. The code below will change the title but I can't work out how to construct it to all me to pass in the chartname variable.

In the below code chtTrust is the actual chart name and strChtTitle is the new title variable. I would like to pass in chtTrust as a variable so I can use the code for 2 other charts chtHospital and chtWard



Sub chtTitlechange(strChtTitle As String)

With Me.chtTrust.Object.Application.Chart
.charttitle.Text = strChtTitle 'Me.txtbox.Value
End With

End Sub



Any ideas please :dunno

I have referenced microsoft graph but cannot seem to get it to run