1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| Dim MaTableId As Object
Dim MaTableIndex As Object
Dim ADODOX As Object
Dim ADODOXCatalog As Object
Dim MaTableName As String, NomBase As String
'Nom de la table à créer
MaTableName = "MaTableTest"
'Nom de la base
NomBase = "C:\Documents and Settings\mimi\dossier\DataBase.mdb"
Set ADODOX = CreateObject("ADOX.Catalog")
Set ADODOXCatalog = ADODOX
Set MaTableId = CreateObject("ADOX.Table")
Set MaTableIndex = MaTableId
With ADODOXCatalog
.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & NomBase & ";"
On Error Resume Next
'Supprime la table si elle exsite déjà
.Tables.Delete MaTableName
On Error GoTo 0
End With
'7= adDate
'203 = adVarWChar (memo)
'130 = adWChar (texte)
'3 = adInteger
With MaTableIndex
.Name = MaTableName
With .Columns
.Append "DateCreation", 7, 10
.Append "DateModif", 7, 10
.Append "DateSupp", 7, 10
.Append "NumberID", 3, 10
.Append "Number2", 3, 10
.Append "Document", 203, 500
.Append "Name", 130, 80
.Append "AKA", 130, 80
.Append "City", 130, 50
.Append "Country", 130, 50
.Append "DateOuv", 7, 10
.Append "DateCertif", 7, 10
.Append "DateEtude", 7, 10
.Append "CityID", 3, 10
.Append "Number3", 3, 10
.Append "RefID", 3, 50
.Append "NomZone", 130, 80
.Append "Notes", 203, 500
.Append "Quartier", 130, 50
.Append "Continent", 130, 50
.Append "DateFermeture", 7, 10
.Append "DateVerif", 7, 10
.Append "Echeance", 7, 10
.Append "xID", 3, 10
.Append "Number100", 3, 10
.Append "Regime", 130, 50
.Append "NameAgence", 203, 500
.Append "TypeAPPT", 130, 80
.Append "Commune", 130, 50
.Append "Region", 130, 50
End With
End With
With ADODOXCatalog
.Tables.Append MaTableId
End With
Set ADODOXCatalog = Nothing
Set MaTableId = Nothing |
Partager