Creating Access Database with ADO through VB6



I have all the code needed to create the database and the tables and
fields, BUT it won't let me make the field AutoIncrement!!!!
grrr!
I've scoured the web and tried everything I can think of, but nothing.
Here is my code:

Option Explicit
Public Function AutoCreateAccess(ByVal sDatabaseToCreate As String) As
Boolean
CreateAccessDatabase (sDatabaseToCreate)

Dim catDB As ADOX.Catalog
Dim tblNew As ADOX.Table
Set catDB = New ADOX.Catalog

' Open the catalog
catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDatabaseToCreate
'-------------------------------------------------
' Create new Table and add the columns
Set tblNew = New ADOX.Table
tblNew.Name = "bellschedule"

With tblNew
With .Columns
.Append "period", adVarWChar, 50
.Append "bellday", adVarWChar, 50
.Append "timefrom", adDate, 8
.Append "timeto", adDate, 8
End With

Dim adColNullable
adColNullable = 2
With .Columns("period")
.Attributes = adColNullable
End With
With .Columns("bellday")
.Attributes = adColNullable
End With
With .Columns("timefrom")
.Attributes = adColNullable
End With
With .Columns("timeto")
.Attributes = adColNullable
End With
End With
catDB.Tables.Append tblNew
'-------------------------------------------------'
'-------------------------------------------------
' Create new Table and add the columns
Set tblNew = New ADOX.Table
tblNew.Name = "schoolinfo"

With tblNew
With .Columns
.Append "schoolname", adVarWChar, 50
.Append "district", adVarWChar, 50
End With

With .Columns("schoolname")
.Attributes = adColNullable
End With
With .Columns("district")
.Attributes = adColNullable
End With

End With
catDB.Tables.Append tblNew

'-------------------------------------------------
' Create new Table and add the columns
Set tblNew = New ADOX.Table
tblNew.Name = "students"

With tblNew
With .Columns
.Append "firstname", adVarWChar, 50
.Append "lastname", adVarWChar, 50
.Append "DOB", adDate, 8
.Append "picture", adBinary
.Append "id", adVarWChar, 25
.Append "gender", adVarWChar, 2
.Append "middlename", adVarWChar, 50

End With

With .Columns("firstname")
.Attributes = adColNullable
End With
With .Columns("lastname")
.Attributes = adColNullable
End With
With .Columns("DOB")
.Attributes = adColNullable
End With
With .Columns("picture")
.Attributes = adColNullable
End With
With .Columns("id")
.Attributes = adColNullable
End With
With .Columns("gender")
.Attributes = adColNullable
End With
With .Columns("middlename")
.Attributes = adColNullable
End With
End With
catDB.Tables.Append tblNew
'-------------------------------------------------
' Create new Table and add the columns
Set tblNew = New ADOX.Table
tblNew.Name = "tardies"

With tblNew
Set .ParentCatalog = catDB
With .Columns
.Append "id", adVarWChar, 25
.Append "tdate", adDate, 8
.Append "ttime", adDate, 8
.Append "period", adVarWChar, 25
.Append "tardyid", adInteger
End With
With .Columns("id")
.Attributes = adColNullable
End With
With .Columns("tdate")
.Attributes = adColNullable
End With
With .Columns("ttime")
.Attributes = adColNullable
End With
With .Columns("period")
.Attributes = adColNullable
End With
With .Columns("tardyid")
.Properties("Autoincrement") = True 'PROBLEM POPS UP
HERE!
.Attributes = adColNullable
End With
End With
catDB.Tables.Append tblNew
'------------------------------------------
Set tblNew = Nothing
Set catDB = Nothing
AutoCreateAccess = True
End Function
Public Function CreateAccessDatabase(ByVal sDatabaseToCreate As String)
As Boolean
Dim catNewDB As ADOX.Catalog
Set catNewDB = New ADOX.Catalog
catNewDB.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDatabaseToCreate & _
";Jet OLEDB:Engine Type=4;"
' Engine Type=5 = Access 2000 Database
' Engine Type=4 = Access 97 Database

Set catNewDB = Nothing
CreateAccessDatabase = True
End Function

The error I get is a Multiple step OLE DB error. When I researched it,
it says that I'm trying to pass something to the database of an invalid
type.
I've tried setting my tardyid to adInteger (serves as Integer, Long,
and AutoNum) and adLongVarWChar. Though if I set it to adInteger then
it shows up as a Long in my database.
If I comment out the part where I set .properties("Autoincrement") =
True, then I don't get this problem

Any suggestions? Thanks so much in advance!

.