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

Manipulating data from text file

Status
Not open for further replies.

suntsu

Programmer
Aug 26, 2001
72
I was wondering how I could retrieve data from a text file, sort on a particular column, replace a record that matches my criteria, then writing over the original file with the new recordset?

text file has two fields...

strPlayer, intScore

There will only ever be 5 records in this file.

Thanks,

SunTsu
 
Create a DAO recordset object selecting the fields from the text file:

SELECT *
FROM [myText.txt]
IN '' [TEXT;DATABASEC:\myPath;]
ORDER BY myField
 
Suntsu,

How do you determine your fields in your text file, are they comma deliminated? What are you using for a datacontrol
ADO or DAO? Anything is possible, the problem is I only have one lifetime.
[cheers]
 
The ISAM driver for TEXT files. The default settings are used which can be globally changed.

To change them for certain files in certain folders use a Schema.INI in the same folder as the Txt, Asc, etc file (you can have a Schema.Ini is each diff. folder but only one in the same folder:

Schema.INI File:
=======================================
[Emp.asc]
rem Employees Table in Asc file
ColNameHeader=False
Format=Delimited(,)
MaxScanRows=0
CharacterSet=OEM
NumberLeadingZeros=True
DateTimeFormat=dd.mm.yy
DecimalSymbol=.
Col1=EmpID TEXT WIDTH 20
Col2=lName TEXT WIDTH 26

[Emp.txt]
rem Employees Table in txt File
ColNameHeader=False
Format=Delimited(~)
MaxScanRows=0
CharacterSet=OEM
NumberLeadingZeros=True
DateTimeFormat=dd.mm.yy
DecimalSymbol=.
Col1=EmpID TEXT WIDTH 20
Col2=lName TEXT WIDTH 26

=======================================
For ADO check out the following:
MS Kb Q262537
 
I guess I didn't ask your other questions:
-In my first answer I stated that I was using a DAO recordset

-No I am not using a DC but you can just as easily.
 
Thanks for the help CCLINT / foada,

I will give this a try tonight using DAO, failing that I will check out the ADO KB article.

Thanks again for the help, much appreciated.

Tsu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top