Hi all,
im going insane trying to debug this on...
im getting an error on the line
Cat.Tables.Append(CType(objTable, Object))
error is invalid type
any help is appreciated
thanks
tryp
Private Sub createTable(ByVal dBasePath As String)
Dim Cn As ADODB.Connection
Dim Cat As ADOX.Catalog
Dim objTable As New ADOX.Table
Dim colMemo As New ADOX.Column
Dim colID As New ADOX.Column
Dim colDate As New ADOX.Column
Cn = New ADODB.Connection()
Cat = New ADOX.Catalog()
'objTable = New ADOX.Table()
''Open the connection
Cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & dBasePath & ";")
'Open the Catalog
Cat.ActiveConnection = Cn
'Create the table
objTable.Name = "Notes"
With colID
.ParentCatalog = Cat
.Name = "NoteID"
.Type = ADOX.DataTypeEnum.adInteger
.Properties("AutoIncrement").Value = True
.Properties("Nullable").Value = False
End With
With colMemo
.ParentCatalog = Cat
.Name = "Note"
.Type = ADOX.DataTypeEnum.adLongVarWChar
.Properties.Item("Nullable").Value = False
End With
With colDate
.ParentCatalog = Cat
.Name = "CreateDate"
.Type = ADOX.DataTypeEnum.adDBTimeStamp
.Properties.Item("Nullable").Value = False
End With
objTable.let_ParentCatalog(Cat)
With objTable.Columns
.Append(colID)
.Append(colMemo)
.Append(colDate)
End With
'Append the newly created table to the Tables Collection
Cat.Tables.Append(CType(objTable, Object))
' clean up objects
objTable = Nothing
Cat = Nothing
Cn.Close()
Cn = Nothing
End Sub
im going insane trying to debug this on...
im getting an error on the line
Cat.Tables.Append(CType(objTable, Object))
error is invalid type
any help is appreciated
thanks
tryp
Private Sub createTable(ByVal dBasePath As String)
Dim Cn As ADODB.Connection
Dim Cat As ADOX.Catalog
Dim objTable As New ADOX.Table
Dim colMemo As New ADOX.Column
Dim colID As New ADOX.Column
Dim colDate As New ADOX.Column
Cn = New ADODB.Connection()
Cat = New ADOX.Catalog()
'objTable = New ADOX.Table()
''Open the connection
Cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & dBasePath & ";")
'Open the Catalog
Cat.ActiveConnection = Cn
'Create the table
objTable.Name = "Notes"
With colID
.ParentCatalog = Cat
.Name = "NoteID"
.Type = ADOX.DataTypeEnum.adInteger
.Properties("AutoIncrement").Value = True
.Properties("Nullable").Value = False
End With
With colMemo
.ParentCatalog = Cat
.Name = "Note"
.Type = ADOX.DataTypeEnum.adLongVarWChar
.Properties.Item("Nullable").Value = False
End With
With colDate
.ParentCatalog = Cat
.Name = "CreateDate"
.Type = ADOX.DataTypeEnum.adDBTimeStamp
.Properties.Item("Nullable").Value = False
End With
objTable.let_ParentCatalog(Cat)
With objTable.Columns
.Append(colID)
.Append(colMemo)
.Append(colDate)
End With
'Append the newly created table to the Tables Collection
Cat.Tables.Append(CType(objTable, Object))
' clean up objects
objTable = Nothing
Cat = Nothing
Cn.Close()
Cn = Nothing
End Sub