If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Saving a recordset as a new database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-01-04, 05:59
PLT PLT is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
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
Reply With Quote
  #2 (permalink)  
Old 09-01-04, 19:24
SCIROCCO SCIROCCO is offline
Registered User
 
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!
Reply With Quote
  #3 (permalink)  
Old 09-02-04, 03:20
PLT PLT is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 09-02-04, 07:54
SCIROCCO SCIROCCO is offline
Registered User
 
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!
Reply With Quote
  #5 (permalink)  
Old 09-02-04, 08:06
PLT PLT is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On