Hi again,
First of all let me say that you're my favourite resource
I'm trying to generate a list of n random number in a query, starting from a table of 100 records in one single field with value from 1 to 100. The query took that table and add a column "random" filled with the GetRand (or Rnd) function. My problem is simple: I got the same random number for every row. And I want a different one.
Now I use this dirty method:
1. created an Add.Query, that add one single record to the table, which is fitted with a counter field that provide the 1->100 ID numbers.
2. created a macro to repeat n time the query of the point one.
But when I need to recreate the random list, I must:
1. delete all records,
2. compact the DB (or the counter will start from lastnumber+1 adding the ID number).
3. repeat the starting macro.
So, I need one of this different solutions:
A. Create a query that give me two fields: one with a ordered 1 to 100 integer numbers, one with a different random number for every row.
B. Find a method to compact the DB in an automated manner with the db open (es. by macro or by module)
Do you have some solutions?
First of all let me say that you're my favourite resource

I'm trying to generate a list of n random number in a query, starting from a table of 100 records in one single field with value from 1 to 100. The query took that table and add a column "random" filled with the GetRand (or Rnd) function. My problem is simple: I got the same random number for every row. And I want a different one.
Now I use this dirty method:
1. created an Add.Query, that add one single record to the table, which is fitted with a counter field that provide the 1->100 ID numbers.
2. created a macro to repeat n time the query of the point one.
But when I need to recreate the random list, I must:
1. delete all records,
2. compact the DB (or the counter will start from lastnumber+1 adding the ID number).
3. repeat the starting macro.
So, I need one of this different solutions:
A. Create a query that give me two fields: one with a ordered 1 to 100 integer numbers, one with a different random number for every row.
B. Find a method to compact the DB in an automated manner with the db open (es. by macro or by module)
Do you have some solutions?
