Random delete

  • Thread starter Thread starter cly
  • Start date Start date
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
 
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
 
Back
Top