Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

how do I move a record from one table to another?

how do I move a record from one table to another?

how do I move a record from one table to another?

I am creating a database and in some instances I will need to move records from one table to another.  It would be similar to a cut and paste of the record.  What I want to do is have a button on a form and when necessary, push the button to have that particular record deleted in its original table and moved to another table (called "Destroyed").

One last point, I probably won't need all the data from a particular record.  What do I need to do to cherry pick the fields I want and have the others deleted?

Thanks in advance..

RE: how do I move a record from one table to another?

On the on click of the button while you are on your current record:

Dim db As Database
Dim rs As Recordset

Set db = Currentdb()
Set rs = db.OpenRecordset("YourSecondTable") ' Change name appropriately

With rs
    ' Here is where you would specify what fields you want to add to your second table.
    You can populate whatever fields you want in your table, with fields from your form.
    !TableFieldName = Me.FormFieldName
  For Example:
    !LastName = Me.LastName
    !BirthDate = Me.txtBirthDate

End With


' Delete the current record
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Jim Lunde
Custom Application Development

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close