Posted on 2006-04-17
Last Modified: 2011-09-20
I have a Table in database 1 that I  need to transfer to database 2(identical table).  

Here is the code I have so far!

and this is the line I need help with" "combined" ="

Option Compare Database
Option Explicit

Private Sub cmdDBPassword_Click()

End Sub
Sub OpenAccess()

    Dim LPath As String
    Dim LCategoryID As Long
    Const DBPWD = "OPPS"

    'Path to Access database
    LPath = "\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\volume.mdb"

    'Open Access and make visible
    Set oApp = CreateObject("Access.Application")
    oApp.Visible = True

    'Open Access database as defined by LPath variable and , false, dbpwd for password
    oApp.OpenCurrentDatabase LPath, False, DBPWD

End Sub

Sub ADOFrromAccessToAccess()
' exports data from the active Access database to another Access Database
' this procedure must be edited before use
Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long
Dim Connection As ADODB.Connection
Dim Recordset As ADODB.Recordset
    ' connect to the Access database
    Set cn = New ADODB.Connection
  'Workgroup Security
cn.Provider = "Microsoft Jet 4.0 OLE DB Provider"
cn.ConnectionString = "Data Source=\\Dtcnas-ilsp002\mandatory\Analysts - Working Files\Carol\Demo\volume.mdb;Jet OLEDB:Database Password=OPPS;"
cn.Properties("Jet OLEDB:System database") = "C:\Program Files\Microsoft Office\system.mdw"

    ' open a recordset
    Set rs = New ADODB.Recordset
    rs.Open "Combined", cn, adOpenKeyset, adLockOptimistic, adCmdTable
      cn.Execute "delete * from Combined"
          docmd.Sendtable "combined" =
End Sub

Question by:ca1358
    LVL 4

    Accepted Solution

    Before I dig through all of your code, I have to ask if you knew about the docmd.copyobject function that would let you copy a table to a different database, as

    docmd.copyobject "c:\mydir\database2.mbd","NewTableName", acTable, "OrigTableName"

    Author Comment

    Thank you!

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Exchange and Third Party application. 8 46
    sum13 challenge 24 69
    fizzArray3  challenge 1 47
    Replace a tag with sed 2 32
    Purpose To explain how to place a textual stamp on a PDF document.  This is commonly referred to as an annotation, or possibly a watermark, but a watermark is generally different in that it is somewhat translucent.  Watermark’s may be text or graph…
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now