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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking to TXT files and creating the fields

Status
Not open for further replies.

Quigger

Programmer
Jan 9, 2003
3
US
I am trying to link a txt file (which is in a CSV format) to my database, and then create the fields needed. There are only three needed:
second field - user
third field - date
fourth field - time
all the users are defaulted.

I get the error stating that the fields are not defined, and I'm not sure the file is even linking.
Any help would be greatly appreciated!

Private Function dbOpen()
Dim db As Database, tdf As TableDef
Dim strfile, strfolder As String
Dim fdt As String

Set db = CurrentDb

fdt = Format(Date, "yymm")
strfolder = "\\xorl001\groups\esd\fleet_mon_diag\tools\pdcdb\data\rdsct\"
strfile = "in" & fdt & ".txt"

Set tdf = db.CreateTableDef(strfile)

tdf.Connect = "text;" & strfolder

db.TableDefs.Append tdf
RefreshDatabaseWindow

End Function
 
Are your field names included as column headers in row 1 of your text file? Hope this helps and Good Luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top