This worked in earlier versions. But my client has moved to Access 2010 and Windows 7 recently.
I'm creating a bar graph in an Excel file. Then I'm setting the source doc of an unbound object frame to that Excel file. This has worked perfectly for years and years and years.
But it's not working now so I'm rewriting the code. Nothing I find online seems to solve the problem.
Here's my code:
With frm("oleHistogram")
.OLETypeAllowed = acOLEEmbedded
.Class = "Excel.Sheet"
.SourceDoc = sUsersWindowsTempPath & sCapStudyTempFileForExcelHistogram
.Action = acOLECreateEmbed
End With
Again, the oleHistogram object is an unbound object frame on a form. The variable "frm" is that form. The error occurs at .Action = acOLECreateEmbed. It is "The bound or unbound object frame you tried to edit does not contain an OLE object."
All the other code runs fine. And if I comment out the offending line, all runs error free but the report does not show the graph.
The form that contains the graph is a subform on a report. Again, this has worked perfectly for a dozen years. What I had previously done was to hard code the file name and path as a linked source doc in the unbound object frame. None of my code modified the ole object. I simply would recreate the xls file on the drive before running the report. But that was not working at all in the new environment. So I had to go the above route which according to my research should work.
Thanks :)