Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8

    move a selected record from a table to another table

    Dears ,



    I need to macros code to be embedded in a button in Access 2013 that it can move the selected record and move it to another table with one click , can anyone help me please ?

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Create an append query and run it in the macro. Refer to the fields on the form in the query.

  3. #3
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    Can you give me more details about the steps ? Because im new to Access thank you in advance

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    To create an append query, go to Create>query. Click on Append, it will ask you the table name. Type in each field from the form: Forms!formname!fieldname and select which field to append it to. Save the query. Then for your macro select RunQuery and type in the query name.

  5. #5
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    There are two options for creating query , query wizard and query design, so which one I should use?

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    Query design.

    You really need to do some tutorials on basic Access.

  7. #7
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    I have reached to the step of using the append query in my command button, could you please give me detailed steps in how to do that?

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    for your macro select RunQuery and type in the query name

  9. #9
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    Im getting this error
    An insert into query cannot contain a multi valued field

  10. #10
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    Can anyone help me please?

  11. #11
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    You have come across just one of the MANY reasons why tables should not contain multi-valued fields. They go against the principle of proper database design, and can cause no end of problems, especially in queries. My suggestion is to redesign your database, replacing multi-valued fields with proper one-to-many relationships (read up on data normalization). You will probably have to re-think some of your procedures because you are now working with multiple related records instead of just one.

  12. #12
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    I have two tables exactly the same columns names and data type so why im having this issue? Do I have to change them?

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Why do you want to 'move' record? This really should not even be necessary.

    As John_G says, multi-value field causes significant complication.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    samiwin is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2017
    Posts
    8
    What I exactly want is that I want to transfer the selected record in a form to another table while deleting that record from the source table , can I use append query for this? Or there are better solutions?

  15. #15
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    That tells us what you want but not why. Why do you want to move a record?
    Is this merely to 'archive' a record, to make it 'inactive'?
    Why not leave record in table and just change the value in a field? Perhaps simply a Yes/No type field named IsNotActive. Then apply filter criteria to that field to exclude 'archived' records.

    Review:

    https://support.office.com/en-us/art...C-6DE9BEBBEC31

    https://access-programmers.co.uk/for...d.php?t=204915
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 02-06-2015, 01:18 PM
  2. Replies: 15
    Last Post: 07-09-2014, 09:42 AM
  3. Replies: 2
    Last Post: 07-30-2013, 03:40 PM
  4. Replies: 19
    Last Post: 06-05-2012, 08:19 AM
  5. Move a record from one table to another table.
    By botts121 in forum Programming
    Replies: 4
    Last Post: 06-25-2009, 12:53 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