views:

358

answers:

1

I need to create a linked table from MS Access to a view in Oracle. I am creating the linked table from VBA using the following

DoCmd.TransferDatabase acLink, "ODBC Database", [ODBC connect stuff], _
                       acTable, mySourceView, myDestinatonTable, , True

This is working and creates a link to the Oracle view. However, Access can't decide what the primary key is when linking and so it prompts the user, which I don't want it to do. Is there any way I can specify the primary key, or tell Access not to set a primary key, so that the primary key prompt doesn't appear?

+2  A: 

Create the linked table manually with the primary key specified. Go to the Immediate window by Ctrl+G and view the Connect string using the following: ?CurrentDb.TableDefs("tablename").Connect

Then, using the code as ACC2000: Procedure to Create Data Sources and Relink ODBC Tables as a guide you can recreate the connect string.

Tony Toews
That did the trick -- no primary key prompt and no primary key. Thanks!
jbourque