Stuck with linking Access tables using ADOX and ASP

C

Chav

Hello,

I am trying to create tables linked from one Access database into
another after uploading to a web server. My code looks like this:

Sub AddLinkedTable(tName, DBConn, LinkedDbPath, DBpassword)
set adoCat = Server.CreateObject("ADOX.Catalog")
set adoTbl = Server.CreateObject("ADOX.Table")
adoCat.ActiveConnection = DBConn
set adoTbl.ParentCatalog = adoCat
adoTbl.Name = tName
' the code breaks at the following line:
adoTbl.Properties("Jet OLEDB:Create Link") = True
adoTbl.Properties("Jet OLEDB:Link Datasource") = LinkedDbPath
adoTbl.Properties("Jet OLEDB:Link Provider String") = ";Pwd=" &
DBpassword
adoTbl.Properties("Jet OLEDB:Remote Table Name") = tName
adoCat.Tables.Append adoTbl
adoCat.Tables.Refresh
adoCat.Close
set adoTbl = nothing
set adoCat = nothing
End Sub

The IIS returns error message "ADODB.Properties error '800a0cc1'

Item cannot be found in the collection corresponding to the requested
name or ordinal"

I looked into adoTbl.Properties.Count and it returns 0 as if the
Properties collection is empty.

Please, help.. I am stuck with this for a day.
 
R

Ron Weiner

I am not sure this is the problem but if DBConn is a ADODB.Connection object
you need to change
adoCat.ActiveConnection = DBConn
to
Set adoCat.ActiveConnection = DBConn

Good luck!

Ron W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top