Temporarily delete data

  • Thread starter Thread starter Mike C.
  • Start date Start date
M

Mike C.

Hello.

I am working on a database and I would like to be able to
delete a record but not permanetly. In other words, how
can I move a record(s) from the main table "Contacts" to,
a temporary table (e.g."tempContacts") and vice versa.

Any assistnace would be greaty appreciated.

Thanks,

m.
 
make a copy of tblContacts, structure only; name it tblTempContacts (or
whatever you want). in tblTempContacts: if there is an AutoNumber field,
change it to LongInteger.

create an append query, to copy records from tblContacts to tblTempContacts.
create a second append query, to copy records from tblTempContacts to
tblContacts. create a query to delete records from tblContacts and another
to delete records from tblTempContacts.
presumably you're doing the "temporary delete" and "re-add" from forms.
you'll need to set criteria in all four queries, to pull the current record
on the form. usually you do this by referencing the primary key, as
in the primary key field's column in query design, the criteria would be
Forms!MyFormName!PrimaryKeyFieldName

then, in the tblContacts form, you can set a command button to 1) copy the
current record from tblContacts to tblTempContacts, then 2) delete the
current record from tblContacts. in the tblTempContacts form, do the
opposite: 1) copy from tblTempContacts to tblContacts, then 2) delete from
tblTempContacts.

hth
 
WORKED LIKE A CHARM!

Need to do a bit of tweaking here and there due to some
subforms I have on the main form, but this was perfect!

Thanks again.

m.
 
Back
Top