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.
|