简体   繁体   中英

How to reference a chart object on an MS Access subform?

I have created a dozen different charts using the chart form wizard in Access (so each chart is really a separate form). I have also set up a GUI that has the following nested form structure:

frmMain -> frmSubMain -> Child0 (a subform of frmSubMain)

I have a list box on frmSubMain that lists all the charts, and when a user selects one, I use VBA to change the Source Object of Child0 to the appropriate form for the selected chart. (So in essence, a user can select the desired chart and it is presented.)

I am now trying to add a button to frmSubMain that will copy the currently selected chart to PowerPoint, but I am having trouble with the copy command and referencing the chart object. The chart object on each of the forms is called OLEUnbound0, and here is what I've tried (I have the form name for the chart as a variable 'my_form'):

  • Forms(my_form).OLEUnbound0.acOLECopy
  • Me.Child0.OLEUnbound0.acOLECopy
  • Me.Controls(my_form).OLEUnbound0.acOLECopy

Each gives a different error (for example, the second one gives the error "Method or data member not found"). Part of my confusion is that I have the form name but as a variable, and I'm not sure how to use that variable (since I can't use the standard Forms![frmMain]![frmSubMain]! etc.). What is the syntax for using a variable to reference a subform?

尝试:

Me.Child0.Form.OLEUnbound0.Action = acOLECopy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM