Results 1 to 3 of 3

Thread: Coping tables to a external tables

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2000
    Posts
    10
    I have two different databases, each one has the same table. One is an active and the other is an inactive database. At day's end I want the informantion in the active one to be append it to the the inactive one, how do I do it using VB6 and DAO? I need a little of coding guidence on how to do it. Thank you. [email protected]

  2. #2
    Junior Member
    Join Date
    Mar 2000
    Posts
    16

    Hopefully this will help you

    What you could do is write SQL statments to do this....

    in the general declarations:

    Option Explicit
    Private gdbActiveDatabase as Database
    Private gdbInactiveDatabase as Database
    Private grstActive as Recordset

    Command Button to perform task:

    Dim pstrSQLSELECT as String
    Dim pstrSQLINSERT as string

    Set gdbActiveDatabase = _
    OpenDatabase("path name to active database")
    Set gdbInactiveDatabase = _
    OpenDatabase("path name to inactive database")

    pstrSQLSELECT = "SELECT * FROM (name of active table in database)"

    Set grstActive = _
    FormName.gdbActive.OpenRecordset(pstrSQLSELECT)

    (this will select all records in the active table you specified, then it will assign that record set to grstActive)

    you'll then want to assign the recordset to variables

    and write and INSERT sql statement and execute that, which should put it into the new table!

    Hopefully this will help.

    Rach

  3. #3
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232
    You could use an sql statement, something like:

    dbInactive.Execute "INSERT INTO tbl_inactive
    SELECT * from tbl_active"

    (lookup action queries in the help for the correct syntax)

Posting Permissions

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



Click Here to Expand Forum to Full Width