Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve connection object from an access application object

Status
Not open for further replies.

seaport

MIS
Jan 5, 2000
923
US
I use the following code to start a second Access 2003 database, and tried to open an ADO recordset from it.
Code:
Set appAcc = New Access.Application
appAcc.OpenCurrentDatabase strFileLocation
set rst=New ADODB.Recordset
rst.open "select * from Table1",appAcc.CurrentProject.Connection
I got the following error.
3001, Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

If i create an ADO connection object and intitiate with the following code,
Code:
cnn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFileLocation
set rst=New ADODB.Recordset
rst.open "select * from Table1",cnn
Then the code works. What did I do wrong in the first place?

Thanks in advance.

Seaport
 
The first procedure puts 'Extended Properties=""' into the connection string and that creates the 3001 error.
Becaise the second procedure do not use this argument that connection works. If you include the 'Extended Properties=""' line into the second procedure's connection string, you get the same error.
 
Graham, thanks.

So how do I make the first set of code work?

If the Access Application object exposes an ADODB connection object, is it supposed to work?

Seaport
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top