I am trying to figure out how to add data to database fields using VB6 code.
I wish to import a text file, create a database, then populate the fields
within tables created. I created the following sample using a reference
to DAO 3.6 Object Library and have added the dialog control to the form.

Option Explicit

Dim CostTitle As String
Dim T As String
Dim Response As String

Private Sub cmdCreateDB_Click()
On Error GoTo DialogCancel
With CommonDialog1
.CancelError = True
.FileName = "*.mdb"
.DialogTitle = "Create a New Database"
.Filter = "Access Database File(*.mdb)|*.mdb"
.InitDir = "c:\access\"
.ShowOpen
T = Dir("C:\access\" & .FileTitle)
If Len(T) <> 0 Then
Response = MsgBox("File already exists, erase?",
vbQuestion + vbYesNo, "File Already Exists")
If Response = vbYes Then
Kill .FileName
End If
If Response = vbNo Then
MsgBox "Operation cancelled"
Exit Sub
End If
End If
CostTitle = .FileName
End With

'Create the database
Dim db As Database
Set db = DBEngine(0).CreateDatabase(CostTitle, dbLangGeneral,
dbVersion30)

'Define a variable as a tabledef object
Dim TblDef As TableDef

'Create the first table in the database named 'Employee'
Set TblDef = db.CreateTableDef("Employee")

'Create fields within the table
With TblDef
.Fields.Append .CreateField("FirstName", dbText, 15)
.Fields.Append .CreateField("LastName", dbText, 15)
.Fields.Append .CreateField("Title", dbText, 25)
.Fields.Append .CreateField("Salary", dbCurrency)
.Fields.Append .CreateField("EmplNum", dbSingle)
db.TableDefs.Append TblDef 'Append the table to the database
End With

'Create a second table in the database called 'Organization'
Set TblDef = db.CreateTableDef("Organization")

With TblDef
.Fields.Append .CreateField("EmplNum", dbSingle)
.Fields.Append .CreateField("Department", dbText, 25)
.Fields.Append .CreateField("Manager", dbText, 25)
db.TableDefs.Append TblDef 'Append the table to the database
End With

'Add data to the fields within the database
Dim FldData As Field






Exit Sub
'-------------------------------------------------------------------------
DialogCancel: MsgBox "Operation cancelled"

End Sub


The above code correctly creates a database file with 2 tables that contain
the appropriate fields. However, my problem is how to populate the database
in my VB6 program that I will be reading from a text file then adding the
appropriate data to the database.

For example, for the Employee table, I would like to add a number of employees
such as:

FirstName: John
LastName: Doe
Title: Engineer
Salary: 75000
EmplNum: 12345

and

FirstName: Jane
LastName: Smith
Title: Sales Rep
Salary: 50000
EmplNum: 12345

and to the Organization table, I would like to add

EmplNum: 12345
Department: Engineering
Manager: Frank Jones

and

EmplNum: 67890
Department: Sales
Manager: Terry Moore

I am not interested in creating primary keys or linkages between the tables,
simply creating a database file and populating the fields with data, that
can be opened using Access. All the reference material I have read explain
the method of creating database files, adding tables and fields, but they
don't deal with adding data to the records.

Any help would be appreciated.