Hi people, I´m have to create a table every month in my app, this table register some transactions month by month, the name is: month+year,ok, my problem is in the sentence:
cat.Tables.Append tblnueva I obtain the error "type is invalid", why is that? what is my error?. Thanks everybody.
Function newtable()
Dim xmes As String
Dim xaño As String
Dim newnombre As String
Dim cat As ADOX.Catalog
Dim tblnueva As ADOX.Table
xmes = Str(Month(Now))
xaño = Mid(Str(Year(Now)), 4)
newnombre = Trim(xmes & xaño)
Set cat = New ADOX.Catalog
setcon
cat.ActiveConnection = glo.cnBudget
Set tblnueva = New ADOX.Table
With tblnueva
Set .ParentCatalog = cat
.Name = newnombre
.Columns.Append "id", adInteger
!id.Properties("AutoIncrement" = True
.Columns.Append "dese", adVarChar, 80
.Columns.Append "mone", adCurrency
.Columns.Append "fecven", adDate
.Columns.Append "canc", adBoolean
.Keys.Append "id", adKeyPrimary, "id"
End With
cat.Tables.Append tblnueva
cat.ActiveConnection.Close
Set cat = Nothing
End Function
cat.Tables.Append tblnueva I obtain the error "type is invalid", why is that? what is my error?. Thanks everybody.
Function newtable()
Dim xmes As String
Dim xaño As String
Dim newnombre As String
Dim cat As ADOX.Catalog
Dim tblnueva As ADOX.Table
xmes = Str(Month(Now))
xaño = Mid(Str(Year(Now)), 4)
newnombre = Trim(xmes & xaño)
Set cat = New ADOX.Catalog
setcon
cat.ActiveConnection = glo.cnBudget
Set tblnueva = New ADOX.Table
With tblnueva
Set .ParentCatalog = cat
.Name = newnombre
.Columns.Append "id", adInteger
!id.Properties("AutoIncrement" = True
.Columns.Append "dese", adVarChar, 80
.Columns.Append "mone", adCurrency
.Columns.Append "fecven", adDate
.Columns.Append "canc", adBoolean
.Keys.Append "id", adKeyPrimary, "id"
End With
cat.Tables.Append tblnueva
cat.ActiveConnection.Close
Set cat = Nothing
End Function