MyTetra Share
Делитесь знаниями!
Append_Ex
Время создания: 16.03.2019 23:43
Раздел: !Закладки - VBA - Access - Link

Option Compare Database


Sub test_Append_Ex()

Dim db As Database

Dim oTdl As TableDef, strTbl As String

Set db = CurrentDb

'Set tdf = db.CreateTableDef("Ôèðìû")

'tdf.Connect = ";DATABASE=путь.accdb" ';PWD=12345"

'tdf.SourceTableName = "Ôèðìû"

'db.TableDefs.Append tdf


strTbl = "DelDate"

db.Execute ("drop table " & strTbl)


Set oTdl = db.CreateTableDef(strTbl)

oTdl.Connect = "Excel 12.0 Xml;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=D:\LocalData\username\Downloads\ListPoint_Date_h (5).xlsx" ';PWD=12345"

oTdl.SourceTableName = strTbl & "$"

db.TableDefs.Append oTdl



strTbl = "ListPJI"

db.Execute ("drop table " & strTbl)


Set oTdl = db.CreateTableDef(strTbl)

oTdl.Connect = "Excel 12.0 Xml;HDR=YES;IMEX=2;ACCDB=YES;DATABASE=путь.xlsx" ';PWD=12345"

oTdl.SourceTableName = strTbl & "$"

db.TableDefs.Append oTdl



End Sub



'===========================================================

Option Compare Database

Sub ss()

'DATABASE Attributes - 1073741824

'Excel Attributes - 1073741824

'Dim tdf As TableDef

Dim oTbl As TableDef

Dim oPr As Properties

Dim iAttr As Long

On Error Resume Next

For Each oTbl In CurrentDb.TableDefs

iAttr = oTbl.Properties("Attributes")

If iAttr > 3 Then

Debug.Print oTbl.Name & " - " & oTbl.Connect

For i = 0 To oTbl.Properties.Count

strPeName = oTbl.Properties(i).Name

strPrVal = oTbl.Properties(i).Value

Debug.Print " " & strPeName & " - " & strPrVal

strPeName = oTbl.Properties(i).Name

strPrVal = oTbl.Properties(i).Value

Next i

End If

' If tdf.Type = "LINK" Then

' k = k + 1

' strTblName = tdf.Name

' sss = tdf.Properties.Item(6)

' sst = DLookup("[PathBase]", "SystemTB", "TName = '" + strTblName + "'")

' If sss <> sst Then

' blnCBase = False

' Exit For

' End If

' End If

'

' For Each oTbl In CurrentDb.TableDefs

' With oTbl

' Debug.Print .Attributes & " | " & .Name & " | " & .Connect

'' f = Left(oTbl.Connect, 4)

' If Left(oTbl.Connect, 4) = "Text" Then

' If Left(oTbl.Connect, 4) <> "List" Then

' DoCmd.Close acTable, oTbl.Name

' CurrentDb.Execute ("drop table " & oTbl.Name)

' End If

' End If

' End With

' Next oTbl

Next oTbl

End Sub

Так же в этом разделе:
 
MyTetra Share v.0.53
Яндекс индекс цитирования