copy and past chart

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 22 employees. I have created 22 different queries for different
performance data. From these I want to creat a chart for each employee.
Now I have created one very good chart for one of the employees, but it took
a fair amount of doing and now I would like all 22 charts to look exactly the
same in appearance. I would LIKE to copy and past the chart and then just
change the SOURCE of the data but I cannot figure out HOW to do this? I
successfully copied and pasted each query and then just changed the criteria
accordingly, but I cannot figure out how to change the source for the chart.
Please help me. I would hate to have to create all 22 charts individually.
 
It sounds like you need to generalize your code a bit: The query on
which your chart is based should accept an input that identifies the
employee. One common way to handle that is to have the criteria for
employee in the query refer back to the control on the form that opens
the report/chart that will have the employee's ID.

HTH
--
-Larry-
--

Steve Y said:
I have 22 employees. I have created 22 different queries for different
performance data. From these I want to creat a chart for each employee.
Now I have created one very good chart for one of the employees, but it took
a fair amount of doing and now I would like all 22 charts to look exactly the
same in appearance. I would LIKE to copy and past the chart and then just
change the SOURCE of the data but I cannot figure out HOW to do this? I
successfully copied and pasted each query and then just changed the criteria
accordingly, but I cannot figure out how to change the source for the chart.
Please help me. I would hate to have to create all 22 charts
individually.
 
I completely agree and that is how I originally wanted to handle this. The
only problem I had with this was that I was unable to get the employee name
that I input to appear at the top of the chart. If you can let me know HOW
to do that, I would be all set.
 
Hi Steve,

You can change the title of a chart object via code, by referring to it as
ChartObjectName.ChartTitle.Caption

So, for example, if your chart is in the detail section of a report, and you
want to change its title to the content of a textbox control named
txtPersonName on a form named frmName, you could use the following:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.ChartObjectName.ChartTitle.Caption =
Forms("frmName").txtPersonName.Value
End Sub

Note: usually, you can refer to the value of a textbox control (in this
case, txtPersonName) simply by .txtPersonName; however, in this case, you
need to use .txtPersonName.Value, otherwise you will get an error message
saying that the caption property cannot be set.

HTH,

Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top