View Full Version : Moving record to another table


bseche
10-24-2001, 04:52 AM
I need help,
I have a table that keeps track of the library books we have. I want the user to be able to click on a button to take the record and move it to another table ( They thinking they deleting it but they actually taking it out the main table and moving it to another table witch is only accessible to admin users . Similar to append query. I don't want it to prompt the user for nothing just take the record they selected and move it.

DJN
10-24-2001, 06:17 AM
Create an update query

INSERT INTO AnotherTableName
SELECT MainTableName.*
FROM MainTableName
WHERE (((MainTableName.[PrimaryKeyFieldName])=[Forms]![FormName]![PrimaryKeyFieldName]));

Then just call the query from the command button.

Private Sub cmdButtonName_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryArchivedData"
DoCmd.OpenQuery "qryArchivedDataDeleted"
DoCmd.SetWarnings True
End Sub

I presume you will also need to have a delete query to take the record out of the main table.

DELETE TableName.*, TableName.[FieldName]
FROM TableName
WHERE (((TableName.[PrimaryKeyFieldName])=[Forms]![FormName]![PrimaryFieldName]));

Call this query also from the command button.

Chris RR
10-24-2001, 06:20 AM
See reply under tables.

Also, users on this forum strongly discourage double-posting questions.