Results 1 to 3 of 3
  1. #1
    tsullvan
    Guest

    Export Field to a file

    Does anyone know of some canned code which loops through a mdb that generates a file from a text field. I have an algorith for the file name already. thanks for the help.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Export Field to a file

    By canned code, do you mean a commercial program or just something someone else has built? Do you want to step through the records in a table or query and write the contents of a particular field to a text file? There's an article in the latest issue of Smart Access from Pinnacle Publications that deals with using a text file as a temporary table, and it includes a method to do pretty much what you seem to be describing. If you decide that the article isn't helpful or your code skills aren't up to it, post again with more detail and someone will be able to help.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    The Netherlands
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Export Field to a file

    Assuming you have the filename in variable strFileName:

    dim db as database
    dim rs as recordset

    set db = currentdb
    set rs = db.openrecordset("tblYourTable", dbOpenSnapShot)
    rs.movefirst
    Open strFileName For Output Access Write Lock Write As #1
    do while not rs.eof
    Print #1, rs![fldYourField]
    rs.movenext
    loop
    set rs = nothing
    set db = nothing
    close #1

Posting Permissions

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