simoncpage
Programmer
I am using the following sub to create a table in access from excel. However all the fields for this database require an input when I add data. How do I add a table and headers that can be left blank?
Sub CreateAccessTableMain(strDBPath As String)
Dim catDB As ADOX.Catalog
Dim tblNew As ADOX.Table
Dim i As Integer
Set catDB = New ADOX.Catalog
catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDBPath
Set tblNew = New ADOX.Table
With tblNew
.Name = "Ten"
With .Columns
For i = 0 To (findlastreviewscol("c" - 4)
.Append "" & Range("topleft".Offset(i, 0).Value & "", adVarWChar
Next i
End With
End With
catDB.Tables.Append tblNew
Set catDB = Nothing
End Sub
Sub CreateAccessTableMain(strDBPath As String)
Dim catDB As ADOX.Catalog
Dim tblNew As ADOX.Table
Dim i As Integer
Set catDB = New ADOX.Catalog
catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strDBPath
Set tblNew = New ADOX.Table
With tblNew
.Name = "Ten"
With .Columns
For i = 0 To (findlastreviewscol("c" - 4)
.Append "" & Range("topleft".Offset(i, 0).Value & "", adVarWChar
Next i
End With
End With
catDB.Tables.Append tblNew
Set catDB = Nothing
End Sub