Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2004
    Posts
    4

    Unanswered: Saving a recordset as a new database

    In VB6 SP6 using an ADO Data Control I want to save an ADODC.Recordset into a new database file (or any file!). The MSDN Help file states that I should use "ADODC1.Recordset.Save <path>".

    This does not work as :

    + the resulting file seems to be unreadable by any application - even as a simple text file although I can see the data in the text file.

    + if I save to an existing MDB database I get an error message saying that the file already exists and if I use On Error Resume Next, no records are appended to the database.

    Any help would be highly appreciated!

    Peter Tyler
    Geneva - Switzerland

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    You can save the recordset in two formats. Either the proprietary Advanced Data Tablegram format (which is the default and unreadable) or in XML which more universal. Here is the syntax for both:

    rsSCIROCCO.Save "C:\Test.xml", adPersistADTG

    or

    rsSCIROCCO.Save "C:\Test.xml", adPersistXML
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Sep 2004
    Posts
    4

    Saving a recordset as a new database

    Thanks, but I don't want ADTG or XML format, I need a simple MDB file!

    Surely there must be a way to open an ADO recordset from an Access Database and save it to a new or existing, blank Access database! Seems a basic VB programming task to me . . .

    Peter Tyler

  4. #4
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    Yes you can do it but it is not by simply calling a command. You must

    A) Automate Access and through the automation create the new Access database.

    b) Using ADOX (extended ADO) create a new table in the access database.

    c) Cycle through your recordset and INSERT every new record to the table.

    You can write a sub or function to do all this and then just call that sub or function every time you need this done.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  5. #5
    Join Date
    Sep 2004
    Posts
    4
    >>. . . Automate Access . . .>>

    What on earth does that mean?

    Thanks (again) but I will look at some other way of doing it.

    Peter Tyler

Posting Permissions

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