Re: refreshing linked tables: NO DAO
- From: "Douglas J. Steele" <NOSPAM_djsteele@xxxxxxxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 19:50:37 -0400
Can't be done with ADO, but it is possible with ADOX. Here's code to link to
every table in a back-end database:
Private Function LinkFEToBEUsingADOX( _
BackendCatalog As ADOX.Catalog, _
PathToBackendDatabase As String _
) As Boolean
On Error GoTo Err_LinkFEToBEUsingADOX
Dim objFECatalog As ADOX.Catalog
Dim objFETable As ADOX.Table
Dim objBETable As ADOX.Table
Dim booStatus As Boolean
Dim strTableNm As String
booStatus = True
Set objFECatalog = CreateObject("ADOX.Catalog")
objFECatalog.ActiveConnection = _
CurrentProject.Connection
For Each objBETable In BackendCatalog.Tables
If Len(objBETable.Type) = 0 Then
strTableNm = objBETable.Name
Set objFETable = CreateObject("ADOX.Table")
objFETable.Name = strTableNm
Set objFETable.ParentCatalog = objFECatalog
objFETable.Properties( _
"Jet OLEDB:Link Datasource") = _
PathToBackendDatabase
objFETable.Properties( _
"Jet OLEDB:Remote Table Name") = _
strTableNm
objFETable.Properties( _
"Jet OLEDB:Create Link") = True
objFETable.Properties( _
"Jet OLEDB:Link Provider String") = _
"MS Access;PWD=Admin;"
objFECatalog.Tables.Append objFETable
Set objFETable = Nothing
End If
Next objBETable
End_LinkFEToBEUsingADOX:
Set objFECatalog = Nothing
LinkFEToBEUsingADOX = booStatus
Exit Function
Err_LinkFEToBEUsingADOX:
booStatus = False
Err.Raise Err.Number, _
"LinkFEToBEUsingADOX", _
Err.Description
Resume End_LinkFEToBEUsingADOX
End Function
I don't know why you'd need this, though. DAO was designed specifically for
use with Access: it's really the appropriate method for working with Jet
databases. Alternatively, you could simply use the TransferDatabase method,
and not need to use either DAO or ADOX.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"rocco" <rocco@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3A59DA10-DA0C-42E4-A86A-9616EA54C74B@xxxxxxxxxxxxxxxx
hello,
is there any method to refresh linked tables without having to code into
DAO?
Anything in ADO or ADOX?
I think there should be something in ADO, but I'm not able to find out
what.
Help very appreciated.
Rocco
.
- Follow-Ups:
- Re: refreshing linked tables: NO DAO
- From: rocco
- Re: refreshing linked tables: NO DAO
- Prev by Date: Re: Character Set Problem?
- Next by Date: Re: refreshing linked tables: NO DAO
- Previous by thread: Re: Character Set Problem?
- Next by thread: Re: refreshing linked tables: NO DAO
- Index(es):
Relevant Pages
|