Ok, well you *should* create a form for data entry - entering data directly
into the table can cause numerous problems (For example, a user hitting the
down arrow and modifying the next record rather than the one they meant to).
Using a form will give you Events you can use as triggers to run code. This
would most definitely be the preferred method, as you don't have to rely on
someone remembering to manually run a query or two.
Also, do you already have an Archive table setup? It should have the EXACT
same structure as the Main table. (If you haven't set this up yet you can
create it by copying and pasting the Main table and choosing Structure
Only).
Be that as it may, let's say you simply want a saved query to run manually
either at the end of the day or once a week or whatever, this is how you
would go about it:
VERY IMPORTANT: Make a backup copy of your database and makes changes TO THE
BACKUP FIRST as a test. If all goes well, you can rename your original and
pop the backup in it's place, but this way you always have a "go back" point
;-D
First, determine which field in your Main table is going to be the one that
determines whether a record should be copied to the Archive table, then
deleted. You didn't specify, so for the sake of getting this going, I'm
going to pretend that field is called Shipped and it's a date field.
- Go to the database window and select Queries.
- Create Query in Design View
- Select the table with the data you want to use (in this example the Main
table). You can click cancel to get out of the "choose tables" mode.
- On the Query menu select Append query, choose the Archive table as the
destination.
- select all the fields from your Main table (not the asterisk, but all the
field names), and Append To should fill in automatically if the tables are
designed the same.
- On the Shipped field, Criteria row, type in Is Not Null. If you change
your view to datasheet view you will see that only records with the Shipped
field populated are listed. This is a good way to see what data the query is
looking for.
- Save the query as something descriptive, "MoveToArchive" or something and
close it.
Note the query has a Plus sign - this shows you at a glance that it's going
to actually DO something to modify your data.
- Double click your saved query to run it this will copy the Shipped records
to the Archive table. Check the Archive table to be sure that all these
records were added correctly.
That's the first half - I don't want to start deleting anything until we
know the data is being copied correctly, ok?
Let me know how this works out, I'll be back here in the morning.
Susan