Two question, same objective (different random numbers query vs compact and repair)

Chromium

Registered User.
Local time
Today, 10:05
Joined
Feb 4, 2008
Messages
25
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?:)
 
Apparently you have a problem and this is the way you want to solve it.
Perhaps this database will point you in the right direction.
I have created two tables with 10 records each. Using a cartesian product this will add up to 100 recs. I have used the rnd function to create a different number for each record.

HTH:D
 

Attachments

Apparently you have a problem and this is the way you want to solve it.
Perhaps this database will point you in the right direction.
I have created two tables with 10 records each. Using a cartesian product this will add up to 100 recs. I have used the rnd function to create a different number for each record.

HTH:D


Works Great tnks ;)
 

Users who are viewing this thread

Back
Top Bottom