Random delete

C

cly

i am looking for a way that i can set up a databse or a
teable so it will automatically random delet records. it
is supposed to be a lottyer database, so i need to be able
to delete 43 out of every 49 records.

can you help
 
K

Kevin

You will need to have the primary key on the table with
the records your deleting be an autonumber field. In VBA
you would generate a randome number using the rnd
function. You can bound these numbers if you need to.
Access VBA help provides the method.

You will have to find out what the max and min values are
currently for the primary key (autonumber) field. After
you do this you would need a loop. Set a counter to 0
before the start of the loop, then enter the loop, find a
random number, delete the record for that number, loop,
etc. When your counter reaches 43, exxit the loop.

Hope that helps! If you need help on how to do this, post
back and I will try to help.

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top