Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying and Pasting Records

Status
Not open for further replies.

RedNightshade

Programmer
Jul 16, 2003
2
0
0
CA
I want to be able to program a button so when you click it, it takes the record you are currently on, copies it into a different table and deletes it from the table it is currently in. Any clue on how to do this?
 
This is possible, but problematic in design. What if you delete it out of the first table and fail to append it to the next table? Or the other way round--cannot delete item, but can add it to the next table?


This is possible. The simplest (but ugliest) way to do this is to create two queries: one pulls data off of the textboxes on the first form and appends it to table #2. Another query deletes the item from table #1 where ID = ID currently displayed in the form. Run both queries at the click of your button (the order is important.)
 
Steps:
1. Create an append query to copy the record to your table.
2. create a delete query to remove the record.
You can write a macro to run these two queries in the order mentioned above. The event "on click" of your button you reference the name of the macro.
 
How do I get the value of the ID# off of the current form?

I have a product# in my query so I'm setting the critera equal to the product# off the form, but I don't know what code will do that.
 
1. Go to your form design
2. Find the textbox bound to your ID number
3. Give that textbox a meaningful name by changing the name "Property"
4. Save,close form
5. Query design of the query
6. Go to "Criteria" of the ID
7. Use the expression builder
8. Go to forms->formname->your_new_textboxname
9. done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top