Results 1 to 13 of 13

Thread: copy table from a database to annother[RESOLVED]

Hybrid View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2004
    Posts
    1,414

    Re: copy table from a database to annother

    hi:

    The paths are:

    source path - c:\program files\exp\new.mdb

    destination Path - c:\program files\dali\news.mdb

    Table with all records to copy from the source path - india

    table for destination path - india


    note:The databases are equals...they have the same tables,everything is equal...the diference is the path!

    Thanks

  2. #2
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: copy table from a database to annother

    Try this...

    VB Code:
    1. 'reference microsoft ActiveX Data Objects
    2. Dim adoConnection As ADODB.Connection
    3. Set adoConnection = New ADODB.Connection
    4. adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\program files\exp\new.mdb"
    5. adoConnection.Execute "INSERT INTO india [IN 'c:\program files\dali\news.mdb'] SELECT india.* FROM india"
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2004
    Posts
    1,414

    Re: copy table from a database to annother

    hi:

    thanks for your reply!

    I have convert the code for my reality and I got this error:

    Run time error '3134'
    Syntax error in INSERT INTO statement

    Code:
    Dim db As Database
    Set db = Workspaces(0).OpenDatabase("c:\program files\exp\new.mdb")
    db.Execute "INSERT INTO india [IN 'c:\program files\dali\news.mdb'] SELECT india.* FROM india"
    3

    Thanks

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: copy table from a database to annother

    This should work...

    VB Code:
    1. Dim db As Database
    2. Set db = Workspaces(0).OpenDatabase("c:\program files\exp\new.mdb")
    3. db.Execute "INSERT INTO india IN 'c:\program files\dali\news.mdb' SELECT india.* FROM india"
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2004
    Posts
    1,414

    Re: copy table from a database to annother

    thanks for your help...now the code work very well

  6. #6
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: copy table from a database to annother[RESOLVED]

    Glad it worked now!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  7. #7
    Frenzied Member David.Poundall's Avatar
    Join Date
    Sep 2002
    Location
    Robin Hood Land
    Posts
    1,457

    Re: copy table from a database to annother

    Quote Originally Posted by dee-u
    This should work...

    VB Code:
    1. Dim db As Database
    2. Set db = Workspaces(0).OpenDatabase("c:\program files\exp\new.mdb")
    3. db.Execute "INSERT INTO india IN 'c:\program files\dali\news.mdb' SELECT india.* FROM india"
    Dee-u do you have any idea what the syntax would be when both databases are password protected?
    David

    Learn the Rules so that you know how to break them properly.

    Printing dll dBTools MZTools Winsock API WinsockVB More Winsock SGrid2 MSChart Mail2Web

    If you have found this thread useful then read this

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