Adjuntar tablas en acces provenientes de Oracle
Publicado por Maikel E Pelaez Martinez (5 intervenciones) el 19/03/2005 00:32:40
No hay manera que logre acceder a la coleccion properties del objeto adox.table.
Alguin me da una idea?
maikel
[email protected]
Private Sub mnuAdjTab_Click()
Dim ObjCon as Conection
Dim tblLink As ADOX.Table
Dim catDB As ADOX.Catalog
Dim rsTables As Recordset
Set ObjCon = New Connection 'esto
'es con ADO
With ObjCon
.Open strCon
Set rsTables = .OpenSchema(adSchemaTables)
' rsTables.MoveFirst
lnCount = 0
'
Do Until rsTables.EOF
lnCount = lnCount + 1
StrMsj = rsTables("Table_name")
If StrMsj = "tab_paquetes_detalles1" Then
MsgBox "Las tablas ya estan adjuntadas", vbCritical, "DISPAJ"
ObjCon.Close
''WS.Close
Set ObjCon = Nothing
''Set WS = Nothing
''Set DB = Nothing
Set rsTables = Nothing
Exit Sub
End If
rsTables.MoveNext
Loop
End With
'Si no existen las tablas adjuntas entonces las creara
'' Prueba adjuntar con ado
Set tblLink = New ADOX.Table
Set catDB = New ADOX.Catalog
catDB.ActiveConnection = ObjCon
With tblLink
'Name the new Table and set its ParentCatalog property to the
'open Catalog to allow access to the Properties collection.
.Name = "Tab_paquetes_detalles1"
Set .ParentCatalog = catDB
' Set the properties to create the link.
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Link Datasource") = strConOracle
.Properties("Jet OLEDB:Remote Table Name") = "tab_paquetes_detalles"
End With
Set tblLink = Nothing
End Sub
Alguin me da una idea?
maikel
[email protected]
Private Sub mnuAdjTab_Click()
Dim ObjCon as Conection
Dim tblLink As ADOX.Table
Dim catDB As ADOX.Catalog
Dim rsTables As Recordset
Set ObjCon = New Connection 'esto
'es con ADO
With ObjCon
.Open strCon
Set rsTables = .OpenSchema(adSchemaTables)
' rsTables.MoveFirst
lnCount = 0
'
Do Until rsTables.EOF
lnCount = lnCount + 1
StrMsj = rsTables("Table_name")
If StrMsj = "tab_paquetes_detalles1" Then
MsgBox "Las tablas ya estan adjuntadas", vbCritical, "DISPAJ"
ObjCon.Close
''WS.Close
Set ObjCon = Nothing
''Set WS = Nothing
''Set DB = Nothing
Set rsTables = Nothing
Exit Sub
End If
rsTables.MoveNext
Loop
End With
'Si no existen las tablas adjuntas entonces las creara
'' Prueba adjuntar con ado
Set tblLink = New ADOX.Table
Set catDB = New ADOX.Catalog
catDB.ActiveConnection = ObjCon
With tblLink
'Name the new Table and set its ParentCatalog property to the
'open Catalog to allow access to the Properties collection.
.Name = "Tab_paquetes_detalles1"
Set .ParentCatalog = catDB
' Set the properties to create the link.
.Properties("Jet OLEDB:Create Link") = True
.Properties("Jet OLEDB:Link Datasource") = strConOracle
.Properties("Jet OLEDB:Remote Table Name") = "tab_paquetes_detalles"
End With
Set tblLink = Nothing
End Sub
Valora esta pregunta


0