ACC2000: Error Message: "Object Invalid or no Longer Set" in Query with Linked Oracle Table (243459)
The information in this article applies to:
This article was previously published under Q243459 Moderate: Requires basic macro, coding, and interoperability skills.
This article applies only to a Microsoft Access database (.mdb).
SYMPTOMS
When you run a query that contains a linked Oracle table, you receive the following error message:
Object Invalid or No Longer Set
CAUSE
The foreign key of the Oracle table is an integer. Microsoft Jet is converting it to a decimal, and this causes the error in the query.
RESOLUTION
To resolve this issue, follow these steps:
-
Open the query in Design view.
-
On the View menu, click SQL.
-
In the JOIN statement, surround the foreign key field with the CInt() function, which converts the field to an integer.
For example, if you have the following SELECT statement in SQL View, where tbl_Orders is a local Access table and ORA_tbl_OrderDetails is a linked Oracle table
SELECT tbl_Orders.OrderID, tbl_Orders.OrderDate,
ORA_tbl_OrderDetails.OrderID, ORA_tbl_OrderDetails.ItemName FROM tbl_Orders
INNER JOIN ORA_tbl_OrderDetails ON tbl_Orders.OrderID =
ORA_tbl_OrderDetails.OrderID;
you would change the statement as follows, which places the OrderID foreign key of the Oracle table inside the CInt() function. This is the only change needed:
SELECT tbl_Orders.OrderID, tbl_Orders.OrderDate,
ORA_tbl_OrderDetails.OrderID, ORA_tbl_OrderDetails.ItemName FROM tbl_Orders
INNER JOIN ORA_tbl_OrderDetails ON tbl_Orders.OrderID =
CInt(ORA_tbl_OrderDetails.OrderID);
NOTE: If you include this function, you will not be able to view the query in Design view without losing the join. This is because there is no way for Access, in Design view, to represent a join to a field that is inside a function.
-
Save your query.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 7/13/2004 |
---|
Keywords: | kbbug kberrmsg kbnofix KB243459 |
---|
|