M
Matthew Pfluger
I am trying to create a linked table from Access to our AS/400 database. I
am basing my macro on an Excel macro that uses a SQL call to download data
from the database. My code to build a table using ADOX is below"
Private Sub CreateAS400LinkedTable()
Dim adoCn As ADODB.Connection
Dim adoCat As ADOX.Catalog
Dim adoTbl As ADOX.Table
Set adoCat = New ADOX.Catalog
Set adoTbl = New ADOX.Table
'Create Link...
Set adoCn = CurrentProject.Connection
Set adoCat = New ADOX.Catalog
Set adoCat.ActiveConnection = adoCn
Set adoTbl.ParentCatalog = adoCat
adoTbl.Name = "LinkTable"
adoTbl.Properties("Jet OLEDB:Link Datasource") = "Data
Source=OSK2.OSK.CORP.TRUCK;"
adoTbl.Properties("Jet OLEDB:Link Provider String") =
"Provider=IBMDA400;Force Translate=0"
adoTbl.Properties("Jet OLEDB:Remote Table Name") = "CPJDDTA81.F4105"
adoTbl.Properties("Jet OLEDB:Create Link") = True
' Append the table to the tables collection
adoCat.Tables.Append adoTbl
MsgBox "Link Created..."
End Sub
When I run the code, I get an error "Could not find installable ISAM" when
it tries to append the table. The Provider and Data Source properties work
when called using a SQL connection and string, so how can I use that
information here?
Thanks,
Matthew Pfluger
am basing my macro on an Excel macro that uses a SQL call to download data
from the database. My code to build a table using ADOX is below"
Private Sub CreateAS400LinkedTable()
Dim adoCn As ADODB.Connection
Dim adoCat As ADOX.Catalog
Dim adoTbl As ADOX.Table
Set adoCat = New ADOX.Catalog
Set adoTbl = New ADOX.Table
'Create Link...
Set adoCn = CurrentProject.Connection
Set adoCat = New ADOX.Catalog
Set adoCat.ActiveConnection = adoCn
Set adoTbl.ParentCatalog = adoCat
adoTbl.Name = "LinkTable"
adoTbl.Properties("Jet OLEDB:Link Datasource") = "Data
Source=OSK2.OSK.CORP.TRUCK;"
adoTbl.Properties("Jet OLEDB:Link Provider String") =
"Provider=IBMDA400;Force Translate=0"
adoTbl.Properties("Jet OLEDB:Remote Table Name") = "CPJDDTA81.F4105"
adoTbl.Properties("Jet OLEDB:Create Link") = True
' Append the table to the tables collection
adoCat.Tables.Append adoTbl
MsgBox "Link Created..."
End Sub
When I run the code, I get an error "Could not find installable ISAM" when
it tries to append the table. The Provider and Data Source properties work
when called using a SQL connection and string, so how can I use that
information here?
Thanks,
Matthew Pfluger