?
Solved

Acc2010 The object you referenced ... isn't an OLE object

Posted on 2011-09-14
4
Medium Priority
?
2,413 Views
Last Modified: 2012-05-12
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!

0
Comment
Question by:ComputerFundi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 36541299
Code please.
0
 

Author Comment

by:ComputerFundi
ID: 36541758
Form events run macros not VBA so what follows is macro statements (in acc2010 format)

Submacro: Print_Targets Dept
SetValue
Item = [Forms]![Target_Input].[Visible]
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].[Visible]
Expression = Yes

End Submacro

It is the SetValue statement in the ONclose section which fails with the error
0
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 36541978
What value are you setting? I presume it's the Visible property, but cannot be sure (I don't use macros).

These types of errors can result from many things. One of the more common is incorrectly referring to an Object (for example, not properly referring to a subform control). Earlier versions of Access were far more forgiving of these types of errors, but 2007/2010 is more strict.

In many cases, you're better off building a new, blank database in 2010 (you can use the .mdb format to do this), and then import everything from your old database. This will maintain compatibility with older versions, but will "fixup" the container to be fully compatible with 2010.

Are you sure you need this reference:

Microsoft OLE DB Service Component 1.0 Type Library

This is generally only used to build data links, and isn't really something that you typically reference in an Access app. You can determine if you need it like this:

1) Make a backup of your database
2) Compile your database - from the VBA window, click Debug - Compile. Fix any errors, and continue doing this until the menuitem is disabled
3) Compact your database
4) Remove the reference (i.e. uncheck it).
5) Compile again.

If Step #5 doesn't result in any errors, then you don't need that reference and can leave it out. While in many cases it does no real harm to leave in these refs, they cause unnecessary bloat, and can cause code issues, performance issues, etc etc.


0
 

Author Closing Comment

by:ComputerFundi
ID: 36542668
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!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question