Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Required Fields Help!

Status
Not open for further replies.

simoncpage

Programmer
Apr 4, 2002
256
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top