Results 1 to 9 of 9
  1. #1
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169

    Copy record from one table to another

    Attached is a simple database that I created to try to explain what I am attempting to accomplish with my application database. In essence, I would like to copy the data from one form/subform and its associated tables to another form and its associated tables. I know the first question will be, why do I want to copy data from one table to another? The answer is, the data for both forms reside in different databases which are independent tools for different parts of our business. We would like to "borrow" data from the one database into the other.

    In my example, I put all the tables in one database and labeled one set as LINKED to simulate the linked tables to the second database. I have a button that when clicked, should copy the data from the one form and populate it to the other form where the user can edit if desired.



    I appreciate any help that anybody can lend to get me started with the code for this button. Please see the attached database.
    Thanks, Jim

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Jim,

    in the example, it says nothing about throwing data to another database entirely. What's the target? a second db, or the same db?

    I have read your post, but I wouldn't ask if I could figure it out 100%

  3. #3
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Adam, in the example db attached, the data from tblQuestionsLINKED and tblResponsesLINKED would be copied to tblQuestions and tblResponses which is in the same database. In my real life scenario, these two sets of tables reside in separate databases. I put them into one database in the example to try to simplify the problem. Is that any clearer? I should add, that in my real application, the tables are linked to the other application's data tables. That is why I named them LINKED in the example. Thanks for looking...Jim

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Never dealt with copying data from on db table to another db's table. Simulating it, given the example you gave, would be impossible anyway.

    I would assume you'd have to use the:
    Code:
    application.opendatabase()
    method first, before anything else. Otherwise, how else would you manipulate anything that's in another database?

    If I'm reading this right, that's where to start, at least.

  5. #5
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    Well, I guess I am confusing things more with my example...getting the opposite result of what I intended by providing it! Sorry about that.

    In my real application, all the data tables are held in a backend database and so all the tables in the front end are linked to those datatables. Because I have two different databases for different parts of our business, each has its own set of backend datatables. I want to be able to copy questions/responses from the one database into the other. So, I created linked tables in the front end database to each of the backend datatables for each. So in my application, all the data are accessable in the front end database...to both sets of data. It seems like it would be a simple matter to copy the data in the one form that is displayed to the tables for the other form and then be able to edit that copied data if desired.

    So, lets forget about all that and focus on just the example. Is it possible to copy the data from the one form to the other form and have it copied in the second set of tables? I just cannot believe this is not possible. But, I am by no means any expert and probably doing a bad job of explaining what I am trying to do. Thanks, Jim

  6. #6
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by jpkeller55 View Post
    Is it possible to copy the data from the one form to the other form and have it copied in the second set of tables?
    yes, of course it is.

    you'll either use an append query or recordsets in code. It should really be that simple Jim, but having seen your apps before, hands-on, I can't say that for sure. No offense man, but some of the data structure that I've seen in your apps before is extremely difficult to work with.

  7. #7
    jpkeller55 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    169
    OK, thanks Adam

  8. #8
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by jpkeller55 View Post
    OK, thanks Adam
    no problem. good luck with it, sir!

  9. #9
    junaidi is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2013
    Posts
    1
    thanks alot

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

Similar Threads

  1. Replies: 2
    Last Post: 06-06-2011, 04:18 PM
  2. Copy/paste to new record.
    By xbox1513 in forum Forms
    Replies: 1
    Last Post: 02-23-2011, 04:52 PM
  3. Copy record to different table
    By Patience in forum Access
    Replies: 27
    Last Post: 06-03-2010, 12:19 PM
  4. copy current record to new record
    By er_manojbisht in forum Forms
    Replies: 1
    Last Post: 02-27-2010, 05:31 PM
  5. Copy a record
    By RHall in forum Programming
    Replies: 2
    Last Post: 02-23-2006, 07:40 AM

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