![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Using Insert | Chart, I added a chart object to my report. Ole Class = Microsoft Graph Chart Class = MSGraph.Chart.8 But when I try to instantiate it in VBA, something is wrong: ------------------------------------------------ 1002 Dim myChart As Object 1010 Set myChart = Me.chtWACQ 1020 With myChart 1021 .Activate 1022 .HasLegend = True 1999 End With ------------------------------------------------ Starting with line 1021, I get "Error# 438: Object doesn't support this property or method". OK, maybe we need the object within.... ------------------------------------------------ 1002 Dim myChart As Object 1010 Set myChart = Me.chtWACQ 1020 With myChart 1021 .Activate 1022 .HasLegend = True 1999 End With ------------------------------------------------ I'm missing something. What, besides the line numbers, is the difference |
|
But now line 1010 throws "Error# 2771: The bound or unbound object frame you tried to edit doesn't contain an OLE object. I've been here before, decided it was hopeless, and reverted to creating my charts on Excel spreadsheets. But now it's crunch time: this thing just *has* tb on an MS Access report. The .Activate and .HasLegend are just placeholders to see if I've got the refs right. Once I can get to the chart object, I will do a lot more. Seems like I'm doing something dumb, but what? |
#3
| |||
| |||
|
|
I'm missing something. What, besides the line numbers, is the difference between these two code snippets? None. RCI on my part. |
|
Failing to be explicit. chtWACQ is an ObjectFrame object that has a property called Object that contains a reference to the contained object. Try: dim myChart as Chart set myChart = me!chtWACQ.Object etc. |
#4
| |||
| |||
|
|
Per Bob Barrows: I'm missing something. What, besides the line numbers, is the difference between these two code snippets? None. RCI on my part. The second one shb, per your suggestion, "Set myChart - me!chtWACQ.Object. Failing to be explicit. chtWACQ is an ObjectFrame object that has a property called Object that contains a reference to the contained object. Try: dim myChart as Chart set myChart = me!chtWACQ.Object etc. Intuitively, I get the "ObjectFrame" distinction, but the error that Access throws when I do chtWACQ.Object suggests to me that it does not contain an object. i.e. "Error# 2771: The bound or unbound object frame you tried to edit doesn't contain an OLE object." |
#5
| |||
| |||
|
|
My attempts to reproduce your error have failed. All I can say is "It works for me". Sorry |
#6
| |||
| |||
|
|
Using Insert | Chart, I added a chart object to my report. Ole Class = Microsoft Graph Chart Class = MSGraph.Chart.8 But when I try to instantiate it in VBA, something is wrong: ------------------------------------------------ 1002 Dim myChart As Object 1010 Set myChart = Me.chtWACQ 1020 With myChart 1021 .Activate 1022 .HasLegend = True 1999 End With ------------------------------------------------ Starting with line 1021, I get "Error# 438: Object doesn't support this property or method". |
#7
| |||
| |||
|
|
Where are you putting the code? Certain objects do not exist for certain events. In general, I wouldn't expect this kind of thing to work, since you can't do anything like this with subreports. |
#8
| |||
| |||
|
|
Per David-W-Fenton: Where are you putting the code? Certain objects do not exist for certain events. In general, I wouldn't expect this kind of thing to work, since you can't do anything like this with subreports. Report_Open(). |
![]() |
| Thread Tools | |
| Display Modes | |
| |