Create Table in Microsoft Access From Visual Basic 6.0

1. Create one database in Microsoft Access named: a.mdb and place to C:\
2. Create project in Visual Basic 6.0

Dim db as DAO.Database
Dim tbd As DAO.TableDef
set db=OpenDatabase("C:\a.mdb")
Set tbd = db.CreateTableDef("tblTest")
With tbd
  .Fields.Append .CreateField("ID", dbText)
  .Fields.Append .CreateField("Name", dbText)
  .Fields.Append .CreateField("Sex", dbText)
  .Fields.Append .CreateField("DOB", dbDate)
End With
db.TableDefs.Append tbd

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: