Results 1 to 4 of 4
  1. #1
    rajath is offline Novice
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    2

    Problem of imorting a datatable from one database to another

    Hi All,



    I am Using two password protected databases in my project, Say DB1 and DB2. Password for DB1 = 1 and password for DB2=1.

    I need to import datatable say FirstTermExam present in DB1 and to store it as TempFirstTermExam in DB2. I have used this query:

    INSERT INTO TempFirstTermExam
    SELECT * FROM FirstTermExam IN 'C:\aa\ DB1 .MDB'

    but i am getting error as "not an valid password".

    i am using msacess2003 mdb

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    After Reading you Thread I have assumed that you have the following Requirement
    1) You have two databases both password protected
    2) You want to open one of them and append the data in a table in that database to a table in the current database.

    This is what I have Done:
    1) I have a Database called Sample3.mdb
    2) Password protected, Password is hh
    3) I will import the table Order in my Currentdatabase as Order_list
    4) Close Sample3.mdb.
    5) Append the data in Order_list into a Table Called TempOrder in my currentdb.
    6) Delete the table Order_list imported from Sample3.mdb

    Private Sub Command1_Click()
    On Error GoTo Err_Command1_Click
    '////////////////////////////////////
    'Written By Siddthartha Majumdar 05/08/2010
    'To open a password protected datase and import a Table
    '//////////////////////////////////
    Dim strSQl As String
    'Opening the database with the password
    Set db = OpenDatabase("C:\Sample3.mdb", False, False, _
    ";pwd=" & "hh")
    'Importing the Order Table into the Database as Order_List
    DoCmd.TransferDatabase acImport, "Microsoft Access", "C:\Sample3.mdb", acTable, "Order", "Order_list", False
    'Closing the database
    db.Close
    'An Insert Query to insert The data from Order_list to my TempOrder Table in Current Database
    strSQl = "Insert Into TempOrder Select * From Order_List"
    'Executing the Sql Appending the Data
    CurrentDb.Execute strSQl
    'Deleting the Table Order_list
    CurrentDb.TableDefs.Delete "Order_list" 'If Order_List is there the table is Deleted

    Exit_Command1_Click:
    Exit Sub

    Err_Command1_Click:
    MsgBox Err.Description
    Resume Exit_Command1_Click

    End Sub

    Note: Please replace the mdb File Name, Table Name with the ones in you database.

    Mark the thread solved if this solves your problem

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    is your problem solved if yes mark the thread solved.

  4. #4
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    is your problem solved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Problem with Split Database - Need Help
    By Linda in forum Access
    Replies: 5
    Last Post: 03-22-2010, 09:35 AM
  2. database problem
    By lukifer in forum Access
    Replies: 3
    Last Post: 07-17-2009, 07:39 AM
  3. database problem
    By st3ven_J in forum Access
    Replies: 0
    Last Post: 02-12-2009, 07:27 AM
  4. Database Design Problem
    By Kurth in forum Access
    Replies: 0
    Last Post: 08-14-2008, 04:09 AM
  5. problem with my database
    By skylinekiller in forum Access
    Replies: 1
    Last Post: 01-25-2008, 02:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums