Code to Copy Records to a New Database 
Author Message
 Code to Copy Records to a New Database

I need some help or guidance all would be appreciated.

I am working with a large table.  Approx 100,000 records.  I am trying to
make code which will create a new database structure and create a table in
this new structure containing records associated with a particular month.

I have the code to create the new table.  My question is what is the best
way to make copy these records.  I see too possible solutions. 1.  copy the
table entirely and delete other records out.   2.  Make a make table query
to copy the records.  I have tried the code below and it errors and tells me
that I must have one input field.

Help I am pulling out all my hair trying to overcome this one.

Pete

Public Sub TestExportAFISTransToMonthly()
'
'       Export Trans Master to Newly Created DB for Date Range Selected
'
Dim db As DATABASE, strSQL As String
    Set db = CurrentDb
    Dim ExPath, ExName, ExFile, Target As String
    Dim ExBDate, ExEDate As Date
    ExBDate = 11 / 1 / 98 'Me!BeginDate
    ExEDate = 11 / 30 / 98 'Me!EndDate
    ExPath = "C:\AFIS Download" 'Me!DatabasePath
    ExName = "Test1.mdb" 'Me!DatabaseName
    ExFile = "Nov1998" 'Me!FileIndicator
    Target = ExPath & "\" & ExName
    ExFile = "AFISTransactionsMaster" & " " & ExFile

    strSQL = "SELECT AFISTransactionsMaster.* INTO " & ExFile & "   IN '" &
Target & "'" _
        & " FROM AFISTransactionsMaster" _
        & " WHERE (((AFISTransactionsMaster.Date) Between #11/1/98# And
#11/30/98#)); "
    db.Execute strSQL

End Sub



Tue, 12 Jun 2001 03:00:00 GMT  
 Code to Copy Records to a New Database
i finally got it to work.  It was that usual " " ' " thing.  Thanks anyway.

Pete



Wed, 13 Jun 2001 03:00:00 GMT  
 Code to Copy Records to a New Database
i finally got it to work.  It was that usual " " ' " thing.  Thanks anyway.

Pete



Wed, 13 Jun 2001 03:00:00 GMT  
 Code to Copy Records to a New Database
 Hi, Everybody!
On Fri, 25 Dec 1998 20:17:13 -0600,In microsoft.public.access.queries,

Quote:

>    Dim ExPath, ExName, ExFile, Target As String
>    Dim ExBDate, ExEDate As Date

 Be careful! By these statements you have
!! ExPath As Variant,
!! ExName As Variant,
!! ExFile As Variant,
   Target As String;
!! ExBDate As Variant,
   ExEDate As Date

           Best regards, Serg.

*** Remove asterisk for mail reply!!!



Thu, 14 Jun 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Copying records from jet database to a new jet database

2. Copy an ADO record to a new record?

3. Moving from New Record to Existing Record in Code

4. Help: copying database data into new database

5. how to copy a record from one database to another database with the same struture

6. how copy records from databases to databases ?

7. How to add new records in a new database

8. Copying data into a new record

9. Help: How to copy current record into a new recordset

10. adding new records & new record

11. How do create a copy of a recordset to make a new record

12. Copy record from recordset to a new rec of same set

 

 
Powered by phpBB® Forum Software