Here's my new bummer...
I have some working code to create the table. But whan I want to add the Primary Key... It crashes...
Here's what I have so far...:
I also tried this way:Code:Sub CreeEssence()
Dim cat As New ADOX.Catalog
Dim Essence As New ADOX.Table
Dim EssenceKey As New ADOX.Index
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=d:\projets\voiture2\data\tt.mdb;"
' Set Essence = New ADOX.Table
' Set EssenceKey = New ADOX.Key
With Essence
.Name = "Essence"
Set .ParentCatalog = cat
.Columns.Append "NoVehicule", adInteger
.Columns.Append "DateAchatEssence", adDate
.Columns.Append "Sequence", adInteger
.Columns("Sequence").Properties("AutoIncrement") = True
.Columns.Append "TypeQteEssence", adVarWChar, 1
.Columns.Append "QteEssence", adSingle
.Columns.Append "CoutEssence", adCurrency
.Columns.Append "OdometreEssence", adSingle
.Columns.Append "PetitOdometreEssence", adSingle
.Columns.Append "LieuAchat", adVarWChar, 50
.Keys.Append EssenceKey, adKeyPrimary, "NoVehicule"
.Keys.Append EssenceKey, adKeyPrimary, "DateAchatEssence"
.Keys.Append EssenceKey, adKeyPrimary, "Sequence"
End With
cat.Tables.Append Essence
End Sub
What's wrong with my code...Code:.Keys.Append "NoVehicule", adKeyPrimary, "NoVehicule"
.Keys.Append "DateAchatEssence", adKeyPrimary, "DateAchatEssence"
.Keys.Append "Sequence", adKeyPrimary, "Sequence"
TIA
