Results 1 to 6 of 6

Thread: Ex of select from text file/recset

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497

    Ex of select from text file/recset

    Brucevde was really helpful in supplying the code *below* to create a recordset and write it to a text file. Can you read the recset from the text file in such a way as to "select" from the file?

    For example, I want to get a new recordset from the saved file containing rows whose "Record" field is > 2.

    Here's the code I'm working with to write the text file:

    Set rs = New ADODB.Recordset

    With rs
    .Fields.Append "Record", adInteger
    .Fields.Append "Description", adChar, 30

    .Open

    For lCt = 1 to 3
    .AddNew
    .Fields("Record").Value = lCt
    .Fields("Description").Value = "Description for Record " & str(lCt)
    Next
    .Save "c:\temp\rs.txt", adPersistADTG
    .Close
    End With
    end war
    stop greed

  2. #2
    Addicted Member
    Join Date
    Sep 2003
    Posts
    160
    well you can just read tab delimited files with DAO very fast !
    but I don't get it what does RECSET means? can you please descripe a bit more. is it REVERSE what you mean?

    S. mohammad najafi

  3. #3
    Addicted Member
    Join Date
    Aug 2003
    Location
    houston
    Posts
    185
    msdn about disconnected recordsets

    i hope this goes to the right place

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    You cannot execute queries against a persisted recordset but you can use the Filter property. Not exactly the same thing but may be what you need.

    Also, the persisted recordset is not a text file but binary. Open the file in notepad or wordpad to see its contents.

  5. #5
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Leavenworth KS USA
    Posts
    482
    This may be a useful read:

    http://www.15seconds.com/Issue/000323.htm

    HTH,

    Mongo

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    NY
    Posts
    497
    Thank you all for this useful info. I had a feeling you couldn't query without having some kind of driver underneath. I'm liking the 15seconds article, enough to print all 13 pages. It looks like I'm using a collection after all.
    end war
    stop greed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width