Results 1 to 5 of 5
  1. #1
    botts121 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2009
    Posts
    19

    Move a record from one table to another table.

    I have a database that I am looking to be able to move one record from a table to another table with a click of a button. But moving the record from the one table to another table depends on certain values that is selected in one of the drop down boxes. So I am stuck as to how to do this with the (I'm guessing) VBA code. So if anyone can help, I would greatly appreciate it.



    Thanks in advance,

    Matt

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Not necessarily VBA code but at least two queries; one query to select and append the record to another table and another query to delete the original record.

  3. #3
    botts121 is offline Novice
    Windows XP Access 2003
    Join Date
    Jun 2009
    Posts
    19
    but wouldn't you still need some sort of code to make it work? Like code for in the button itself?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would use code but you can get Macros to run queries if you want. No error checking of course but it works most of the time.

  5. #5
    pdouglas is offline Novice
    Windows XP Access 2002 (version 10.0)
    Join Date
    Jun 2009
    Posts
    12

    Duplicating the Table

    I would make sure the table I am copying stuff be the same as what I am copying from. If you have a field that is linked to another table, keep the link. If you have a field that is calculated, keep that. ....
    Easiest way would be to Right click on the table you are copying, select "Copy", then right click, Paste, and name the new table. Select the Stucture only (don't copy data). Then delete any fields you don't need. This will keep your relationships intact.
    This way, if your county field is numeric and is linked to another table with County Information, it will know that "19" means "Los Angeles" and displays accordingly.

    Still, you would need two queries, one to append from old to new and a second to delete based on whatever criteria you select. I would suggest making the two run seperately so that you could verify the data was copied before deleting it. (Not just run 1 macro with them "Whoomp, Bang".)

    Good Luck
    Paul

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

Similar Threads

  1. Replies: 5
    Last Post: 03-23-2011, 10:39 AM
  2. Replies: 5
    Last Post: 03-31-2009, 09:16 PM
  3. Replies: 0
    Last Post: 01-06-2009, 02:17 PM
  4. Checking a record in a table
    By widstje in forum Programming
    Replies: 4
    Last Post: 11-07-2007, 11:28 AM
  5. Replies: 0
    Last Post: 06-30-2006, 09:00 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