Public Sub DupeTable(TblMaster As String, TblDupe As String, Optional StructureOnly As Boolean = True)
Application.Echo False
DoCmd.TransferDatabase acExport, "Microsoft Access", CurrentDb.Name, _
acTable, TblMaster, TblDupe, StructureOnly
Application.Echo True
End Sub
|
Public Function ConnectPart(TableName As String, part As String) As String
' Retrieves part of a table's connect property
' eg: ConnectPart("tblCustomers", "DATABASE")
' would return the path to the remote file
' or: ConnectPart("tblCustomers", "DSN")
' would return the DSN name (ODBC link)
'
' Zero-length string returned if part is missing/invalid
Const Delimiter As String = ";"
Dim con As String, i As Long, j As Long
con = CurrentDb.TableDefs(TableName).Connect
i = InStr(1, con, Delimiter)
If i = 0 Then Exit Function
If Right$(con, 1) <> Delimiter Then con = con & Delimiter
'
If UCase$(part) = "TYPE" Then
If i = 1 Then
ConnectPart = "ACCESS"
Else
ConnectPart = Left$(con, i - 1)
End If
Else
i = InStr(1, con, part, vbDatabaseCompare)
If i Then
j = InStr(i + 1, con, Delimiter)
If j Then
i = i + Len(part) + 1
ConnectPart = Mid$(con, i, j - i)
End If
End If
End If
End Function
|