Symptoms
When you try to export a 2007 in Microsoft Office Access, Microsoftgraph object programming you receive the following error message:
Run-time Error 1004:
An application definition or object definition error.
When you try to turn off the error message, you receive the following error message:
Operation failed on Chart object.
The OLE server may not be registered.
To register the OLE server, reinstall it.
When you receive an error message, you cannot perform the following actions:
• |
Save a form |
• |
Open a form in a view |
Alternative methods
To resolve this issue, use one of the following methods. Method 1: Export an object after the Action property is set to Acoleclose
1. |
Start Access for 2007 years. |
2. |
The Microsoft Office button opens in turn. |
3. |
In the Open dialog box, select the with to, the database, and then click Open. |
4. |
When you create a menu, click a PivotChart report. |
5. |
On the Design menu, click Show/Hide the field list in the group. This allows you to open a list of chart field lists. |
6. |
Move CategoryName from the Chart field list to the Drop category field. |
7. |
Move productsales from the Chart field list to the Drop data field here. Note by category The chart shows the sum of product sales. |
8. |
Click the Microsoft Office button, and then click Close. |
9. |
Save as a dialog box, type the name of the Frmpivotchart form, and then click OK. |
10. |
Create a menu, click a form group, design the form and move the Frmpivotchart from the Navigation Pane to the designer. Note This procedure creates a subform. |
11. |
Add a command button to the main form and set the command button's Name property to command. |
12. |
In the Design menu, in the Controls group, click the button, and then click Form 2 Designer to place the command button on the form. |
13. |
Command, right-click, and then click Properties. |
14. |
Property Sheet dialog box, click the Events tab, and then click the ellipsis button () to the On Click event. |
15. |
Select the Builder dialog box, select the Code Builder, and then click OK. |
16. |
In the VisualBasic editor, replace the code with the following code.Private Sub Command1_Click() Dim grpApp As Graph.Chart Set grpApp = Me.Graph1.Object grpApp.Export "C:\Graph1.jpg", "JPEG" Set grpApp = Nothing Me.Graph1.Action = acOLEClose End Sub |
17. |
On the File menu, click Close and return to Microsoft Office Access. |
18. |
In the Save dialog box, click Yes. |
19. |
Save as a dialog box, type the name of the Frmmain form, and then click OK. |
20. |
On the main menu, click the Views group, in the view, and click Form view. Body appears in PivotChart view. |
21st. |
In the Frmmain form, click the Command button to export the perspective to the following file: C:\PivotChart1.jpg |
22. |
On the main menu, click the Views group, in the view, and click Design View. Open in Form Design view. |
Method 2: Create a PivotChart object instead of a drawing object This method step is as Method 1, except for steps 16 steps.