Click to See Complete Forum and Search --> : Recordset Save


Creekhead
March 3rd, 2003, 04:24 PM
Yes I'm a newbie and having a problem. I have created an Access2000 DB and made a connection thru VB6 to update records and all is working well. I need to periodically archive this information. I have tried using recordset.save which apparently saves the table that I'm connected to, unfortunately I can't open this file or import it as a table into Access. I'm sure this is a simple task but I could use some help.
Thanks

M Owen
March 4th, 2003, 07:44 AM
Where do you want to archive it to? What exact do you want to archive?

You could save the entire DB .
You could copy the table(s) internally as an archive.
You could do the same externally to another DB ...

Many ways to do this ...

Creekhead
March 4th, 2003, 07:59 AM
I would like to save the DB as a new file name and the clear the records from the original DB's table. Thanks for the response.

M Owen
March 4th, 2003, 09:05 AM
Creek,

Look at the FileSystemObject and specifically the CopyFile method ... As for clearing out a table ... Create a query or run some SQL to the following:

DELETE FROM YourTableNameHere;

This will empty out a table. If you need say some ADO code for this let me know ...

- Mike

Creekhead
March 5th, 2003, 09:24 AM
Thanks for the input I got the file save worked out fine. I'm still having a little trouble with the table clearing in ADO.

M Owen
March 5th, 2003, 10:09 AM
Creek,

Here's some VBA code for ADO that can be adapted for VB ...

Dim SQLString As String
Dim MyConnect As ADODB.Connection
Dim MyRecSet As ADODB.Recordset

Set MyConnect = New ADODB.Connection
Set MyRecSet = New ADODB.Recordset

MyConnect.Open "DSN=YourDSNHere;" 'Or setup a provider string

MyRecSet.CursorType = adOpenDynamic
MyRecSet.LockType = adLockOptimistic

SQLString = "YourQueryHere;"
MyRecSet.Open SQLString, MyConnect
' Do something with this query ....
MyRecSet.Close

MyConnect.Close
Set MyRecSet = Nothing
Set MyConnect = Nothing