I am trying a small example of attaching a textfile to the biblio.mdb, I have set up a empty table called mytable with the fields
name (text)
age (text)
color (text)

I have also set up a .dat file like this
"name","age","color"
"mark","12","red"
"karen","39","blue"
"paul","33","green"
"cee-jay","87","yellow"
"brandon","35","pink"

I want to attach this text file into the database which I presume has a tabledef already (as I have made it in visdata)

I have tried this code to do the task but it won't work, any help would be appreciated. Could you also explain any code submitted in layman's terms as I am relatively new to db programming!.

Option Explicit
Dim mydb As Database
Dim myrs As Recordset


Private Sub Command1_Click()
Dim tdf As TableDef

On Error GoTo errorhandler
Set tdf = mydb.CreateTableDef("mytable")
tdf.Connect = "c:\begDB\biblio.mdb"
tdf.SourceTableName = "c:\Mark\attachfile.dat"
mydb.TableDefs.Delete ("mytable")
mydb.TableDefs.Append tdf
Exit Sub


errorhandler:
MsgBox " crashed and burned baby!"
MsgBox = MsgBox & Err.Number
Exit Sub
End Sub

Private Sub Form_Load()
Set mydb = OpenDatabase("c:\begDB\biblio.mdb")

End Sub

Thanks again ! > locutus