Moving record to another table

bseche

Registered User.
Local time
Today, 15:24
Joined
Aug 13, 2001
Messages
26
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.
 
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.
 
See reply under tables.

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

Users who are viewing this thread

Back
Top Bottom