ComputerFundi
asked on
Acc2010 The object you referenced ... isn't an OLE object
I'm trying to run our Acc 2003 database application in Acc 2010. I have not converted the database, just run it in Acc2010.
Seems to work fine, but when closing a print preview I get
"The object you referenced in the Visual Basic procedure as an OLE Object isn't an OLE object"
The ONClose property runs a sub macro which uses a SetValue command to set a form (from which the report preview was opened) to visible.
Before the report preview was opened the form in question had it's visible value set to no (so it is still open) but hidden.
Worked fine in Acc2003.
So has the syntax changed or dependencies for setvalue on form objects?
A references issue?
These references are loaded (none show MISSING):
Visual Basic for applications (vbe7.dll)
Microsoft Access 14.0 Object Library
OLE Automation (STDOLE2.TLB)
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Object 2.5 Library
Microsoft OLE DB Service Component 1.0 Type Library
Any help greatly appreciated!
Seems to work fine, but when closing a print preview I get
"The object you referenced in the Visual Basic procedure as an OLE Object isn't an OLE object"
The ONClose property runs a sub macro which uses a SetValue command to set a form (from which the report preview was opened) to visible.
Before the report preview was opened the form in question had it's visible value set to no (so it is still open) but hidden.
Worked fine in Acc2003.
So has the syntax changed or dependencies for setvalue on form objects?
A references issue?
These references are loaded (none show MISSING):
Visual Basic for applications (vbe7.dll)
Microsoft Access 14.0 Object Library
OLE Automation (STDOLE2.TLB)
Microsoft DAO 3.6 Object Library
Microsoft ActiveX Data Object 2.5 Library
Microsoft OLE DB Service Component 1.0 Type Library
Any help greatly appreciated!
Code please.
ASKER
Form events run macros not VBA so what follows is macro statements (in acc2010 format)
Submacro: Print_Targets Dept
SetValue
Item = [Forms]![Target_Input].[Vi sible]
Expression = No
OpenReport
Report Name Subject Targets_by Dept_KS5
View Print Preview
Filter Name
Where Condition
Window Mode Normal
MaximizeWindow
End Submacro
Submacro: ONClose
SetValue
Item = [forms]![Target_Input].[Vi sible]
Expression = Yes
End Submacro
It is the SetValue statement in the ONclose section which fails with the error
Submacro: Print_Targets Dept
SetValue
Item = [Forms]![Target_Input].[Vi
Expression = No
OpenReport
Report Name Subject Targets_by Dept_KS5
View Print Preview
Filter Name
Where Condition
Window Mode Normal
MaximizeWindow
End Submacro
Submacro: ONClose
SetValue
Item = [forms]![Target_Input].[Vi
Expression = Yes
End Submacro
It is the SetValue statement in the ONclose section which fails with the error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Fantastic! Thank you:
So here's what I did -
1. In acc2003 (on the unconverted db) - I followed your procedure to remove the reference to Microsoft OLE DB Service Component 1.0 Type Library, which worked - clearly it wasn't needed.
2. I created an empty Accdb file and imported all the tables in the backend (data) db. Compacted it. Done
3. Created another empty ACCDB file and imported all the objects including local (but not linked) tables.
4. Added this library:
Microsoft ActiveX Data Objects 2.8 Library as per this allenbrowne page: http://allenbrowne.com/ser-38.html#LibVer
5. Compiled the db. OK
6. linked tables from ACCDB backend
7. Compacted the dB
7. Tested - so far no issues. The Report close function (with that nice 'tabbed' view of the report) works perfectly.
Again MANY THANKS!
So here's what I did -
1. In acc2003 (on the unconverted db) - I followed your procedure to remove the reference to Microsoft OLE DB Service Component 1.0 Type Library, which worked - clearly it wasn't needed.
2. I created an empty Accdb file and imported all the tables in the backend (data) db. Compacted it. Done
3. Created another empty ACCDB file and imported all the objects including local (but not linked) tables.
4. Added this library:
Microsoft ActiveX Data Objects 2.8 Library as per this allenbrowne page: http://allenbrowne.com/ser-38.html#LibVer
5. Compiled the db. OK
6. linked tables from ACCDB backend
7. Compacted the dB
7. Tested - so far no issues. The Report close function (with that nice 'tabbed' view of the report) works perfectly.
Again MANY THANKS!