This article shows how to create Table in Microsoft Access from Visual Basic 6.0 programming language. If you still use Visual Basic Programming Language for small project connecting with Database in Microsoft Access then you might need the below code to proceed the creation of Table in Microsoft Access from your own software per se by do not need to open Microsoft Access application as usual.
- Assume that we have one MS Access file (a.mdb) in drive C:\ with no Table
- Create Visual Basic 6.0 project and connect to the above MS Access file using DAO
- (In this example we create one Table named tblTest with four columns)
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
|< Prev||Next >|