Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Posts
    66

    Unanswered: Recordset creation?

    is it possible to create and populate a recordset manually?

    I have a values in a text file that i want to load into a recordset so i can then sort it....

  2. #2
    Join Date
    Aug 2004
    Posts
    40
    Access has the facility to import text files provided the files have some sort of field delimiter like a tab, semicolon, comma etc.

    Open a new db then from the file menu select import. It's probably advisable to use the advanced features to set how you want it imported as allowing access to sort it out can unexpected results.

    I'm assuming that this is what you're after...

    Howard

  3. #3
    Join Date
    Oct 2003
    Posts
    66
    Hey thanks for the reply.

    I don't think i could have used the import feature since i will be grabing the file when the user clicks a refresh button, but if you can invoke this in code how?

    And actually the text file is really an XML file (hey i was in a hurry when writing for help).

    What i was trying to do was basically take the xml file and load into a treeview control. The problem was that the xml stream/file was not in the order i needed. So instead of trying to sort the xml as i populate the treeview i wanted to load the xml into a recordset and sort it then populate the treeview. I figured i would create a recordset and then use the fields.append method to add fields and then i would add the xml data to that recordset. I have never used a recordset in this manner, usually i do the rs.open blahblahblha and that populates the recordset with the data for me.

    Anyway, here are the issue i ran into and the solutions in case anyone else ever needs to do soemthing like this:

    1) I couldn't get it to let me add fields to the rs because the object was not SET. but i didn't know what to set it to since i didn't really want to set it to a querie or SQL statement. Finally my brother suggested to try
    "Set rs = new recordset"

    That line allowed me to use the rs.fields.append method to make the structure of the rs.

    2) Then i couldn't add any data (using the add method) to the darn recordset because it was not open! So after scouring the net i found an example where they set the rs.open but used a bogus datasource. It worked and then i was able to add records to the rs.

    Thanks for the help.

  4. #4
    Join Date
    Aug 2004
    Posts
    40
    Glad you sorted it out and posting what you did to do it.

    Good luck with the rest on it.

    Howard

Posting Permissions

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