Hallo zusammen,
bin neu in diesem Forum und bitte um Hilfe bei folgendem Problem:
Habe folgende Programmzeilen in VBA geschrieben und erhalte bei
"cat.Tables.Append tbl" die Fehlermeldung "Die Typangabe ist ungültig".
Dim i As Integer, xxx As Integer
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim spal As New ADOX.Column
Dim cnn As ADODB.Connection, txt As String
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim nomme As String
nomme = CurDir & "\" & "MyDB.mdb"
Set cat = New ADOX.Catalog
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & nomme
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & nomme
Set tbl = New ADOX.Table
With tbl
.ParentCatalog = cat
.Name = "Nummernbuch"
.Columns.Append "StNr", adBigInt
.Columns.Append "Klam"
.Columns.Append "Farbe"
Set spal = tbl.Columns("Farbe")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "LosNr"
Set spal = tbl.Columns("LosNr")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "LosName"
Set spal = tbl.Columns("LosName")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "HA"
.Columns.Append "So"
.Columns.Append "VSo"
.Columns.Append "Rinde"
Set spal = tbl.Columns("Rinde")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Gruppe"
Set spal = tbl.Columns("Gruppe")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "KA"
Set spal = tbl.Columns("KA")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "BHD"
Set spal = tbl.Columns("BHD")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Bef"
Set spal = tbl.Columns("Bef")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Schä"
Set spal = tbl.Columns("Schä")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Käufer"
Set spal = tbl.Columns("Käufer")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Güte"
Set spal = tbl.Columns("Güte")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Länge", adDecimal
Set spal = tbl.Columns("Länge")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
spal.NumericScale = 1
.Columns.Append "Durchm", adInteger
Set spal = tbl.Columns("Durchm")
With spal
.Properties("Nullable").Value = True
.Properties("Jet OLEDB:Allow Zero Length") = True
End With
.Columns.Append "Stärke"
Set spal = tbl.Columns("Stärke")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Festm", adDecimal
Set spal = tbl.Columns("Festm")
With spal
.Properties("Nullable").Value = True
.Properties("Jet OLEDB:Allow Zero Length") = True
.NumericScale = 2
End With
.Columns.Append "Wald"
.Columns.Append "Komm"
Set spal = tbl.Columns("Komm")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "ZNr", adInteger
.Columns.Append "GüNr", adInteger
Set spal = tbl.Columns("GüNr")
With spal
.Properties("Nullable").Value = True
.Properties("Jet OLEDB:Allow Zero Length") = True
End With
.Columns.Append "WaNr", adInteger
Set spal = tbl.Columns("WaNr")
With spal
.Properties("Nullable") = True
.Properties("Jet OLEDB:Allow Zero Length") = True
End With
.Columns.Append "DatenNr", adInteger
End With
cat.Tables.Append tbl
Woliegt hier das Problem. Danke im voraus
bin neu in diesem Forum und bitte um Hilfe bei folgendem Problem:
Habe folgende Programmzeilen in VBA geschrieben und erhalte bei
"cat.Tables.Append tbl" die Fehlermeldung "Die Typangabe ist ungültig".
Dim i As Integer, xxx As Integer
Dim cat As New ADOX.Catalog
Dim tbl As New ADOX.Table
Dim spal As New ADOX.Column
Dim cnn As ADODB.Connection, txt As String
Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim nomme As String
nomme = CurDir & "\" & "MyDB.mdb"
Set cat = New ADOX.Catalog
cat.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & nomme
cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & nomme
Set tbl = New ADOX.Table
With tbl
.ParentCatalog = cat
.Name = "Nummernbuch"
.Columns.Append "StNr", adBigInt
.Columns.Append "Klam"
.Columns.Append "Farbe"
Set spal = tbl.Columns("Farbe")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "LosNr"
Set spal = tbl.Columns("LosNr")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "LosName"
Set spal = tbl.Columns("LosName")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "HA"
.Columns.Append "So"
.Columns.Append "VSo"
.Columns.Append "Rinde"
Set spal = tbl.Columns("Rinde")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Gruppe"
Set spal = tbl.Columns("Gruppe")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "KA"
Set spal = tbl.Columns("KA")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "BHD"
Set spal = tbl.Columns("BHD")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Bef"
Set spal = tbl.Columns("Bef")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Schä"
Set spal = tbl.Columns("Schä")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Käufer"
Set spal = tbl.Columns("Käufer")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Güte"
Set spal = tbl.Columns("Güte")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Länge", adDecimal
Set spal = tbl.Columns("Länge")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
spal.NumericScale = 1
.Columns.Append "Durchm", adInteger
Set spal = tbl.Columns("Durchm")
With spal
.Properties("Nullable").Value = True
.Properties("Jet OLEDB:Allow Zero Length") = True
End With
.Columns.Append "Stärke"
Set spal = tbl.Columns("Stärke")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "Festm", adDecimal
Set spal = tbl.Columns("Festm")
With spal
.Properties("Nullable").Value = True
.Properties("Jet OLEDB:Allow Zero Length") = True
.NumericScale = 2
End With
.Columns.Append "Wald"
.Columns.Append "Komm"
Set spal = tbl.Columns("Komm")
spal.Properties("Nullable").Value = True
spal.Properties("Jet OLEDB:Allow Zero Length") = True
.Columns.Append "ZNr", adInteger
.Columns.Append "GüNr", adInteger
Set spal = tbl.Columns("GüNr")
With spal
.Properties("Nullable").Value = True
.Properties("Jet OLEDB:Allow Zero Length") = True
End With
.Columns.Append "WaNr", adInteger
Set spal = tbl.Columns("WaNr")
With spal
.Properties("Nullable") = True
.Properties("Jet OLEDB:Allow Zero Length") = True
End With
.Columns.Append "DatenNr", adInteger
End With
cat.Tables.Append tbl
Woliegt hier das Problem. Danke im voraus