Randomly generated data

S

Susan

Some time ago I posted a question on how to randomly
sort a list of staff names for a drawing we will be
holding monthly. It seemed like it worked OK during the
test, but now when I actually went to use it, it always
brings up the same name to start. Then whenever i re-run
the query, it generates the next names in the same order.
Here's what I have:

In the query I have the fields [AutoNumber],[FirstName],
[LastName], plus the two fields with the criteria on which
the names will be filtered, both of which are filtered
with a "Yes" in the Criteria row. The query pulls data
from two tables.

Using the instructions, I also entered into the Field
row: Shuffle: Rnd([AutoNumber]) and sorted on that field.
I also typed "randomize" in the debug window prior to
running the query.

As I said, although the names appear to be random, if I
close out the database, then go back into it, put
randomize in the debug window and run the query, the same
name pops up at the top, and each time I run the query the
same rotation of names occurs. Am I missing something
from the initial instructions?

Thanks! Susan
 
S

Susan

Thanks for your response, Douglas. I'm taking my data
from a query...how would I change the code shown in your
example? What syntax should I use? Do I type the *, or
does that stand for something else that I should be
inserting in there? As you can see, I am quite the novice.

I want only 1 random result, so I assume I should select
top 1 instead of the 100...would that change anything else
in the code?

Susan
-----Original Message-----
I'm not sure that typing randomize in the debug window will necessarily have
any impact on your use of the Rnd statement, but I could be wrong.

In any case, see whether the code in
http://www.mvps.org/access/queries/qry0011.htm at "The Access Web" works any
better.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Some time ago I posted a question on how to randomly
sort a list of staff names for a drawing we will be
holding monthly. It seemed like it worked OK during the
test, but now when I actually went to use it, it always
brings up the same name to start. Then whenever i re-run
the query, it generates the next names in the same order.
Here's what I have:

In the query I have the fields [AutoNumber],[FirstName],
[LastName], plus the two fields with the criteria on which
the names will be filtered, both of which are filtered
with a "Yes" in the Criteria row. The query pulls data
from two tables.

Using the instructions, I also entered into the Field
row: Shuffle: Rnd([AutoNumber]) and sorted on that field.
I also typed "randomize" in the debug window prior to
running the query.

As I said, although the names appear to be random, if I
close out the database, then go back into it, put
randomize in the debug window and run the query, the same
name pops up at the top, and each time I run the query the
same rotation of names occurs. Am I missing something
from the initial instructions?

Thanks! Susan


.
 
S

Susan

Hey...after much "fiddling around" I got it to work...and
it's definitely random this time! Thanks again!
-----Original Message-----
Thanks for your response, Douglas. I'm taking my data
from a query...how would I change the code shown in your
example? What syntax should I use? Do I type the *, or
does that stand for something else that I should be
inserting in there? As you can see, I am quite the novice.

I want only 1 random result, so I assume I should select
top 1 instead of the 100...would that change anything else
in the code?

Susan
-----Original Message-----
I'm not sure that typing randomize in the debug window will necessarily have
any impact on your use of the Rnd statement, but I could be wrong.

In any case, see whether the code in
http://www.mvps.org/access/queries/qry0011.htm at "The Access Web" works any
better.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Some time ago I posted a question on how to randomly
sort a list of staff names for a drawing we will be
holding monthly. It seemed like it worked OK during the
test, but now when I actually went to use it, it always
brings up the same name to start. Then whenever i re- run
the query, it generates the next names in the same order.
Here's what I have:

In the query I have the fields [AutoNumber], [FirstName],
[LastName], plus the two fields with the criteria on which
the names will be filtered, both of which are filtered
with a "Yes" in the Criteria row. The query pulls data
from two tables.

Using the instructions, I also entered into the Field
row: Shuffle: Rnd([AutoNumber]) and sorted on that field.
I also typed "randomize" in the debug window prior to
running the query.

As I said, although the names appear to be random, if I
close out the database, then go back into it, put
randomize in the debug window and run the query, the same
name pops up at the top, and each time I run the query the
same rotation of names occurs. Am I missing something
from the initial instructions?

Thanks! Susan


.
.
 
D

Douglas J. Steele

Glad to hear it (especially since I wasn't sure how to explain what you
needed to do to modify Joe's function!)

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Susan said:
Hey...after much "fiddling around" I got it to work...and
it's definitely random this time! Thanks again!
-----Original Message-----
Thanks for your response, Douglas. I'm taking my data
from a query...how would I change the code shown in your
example? What syntax should I use? Do I type the *, or
does that stand for something else that I should be
inserting in there? As you can see, I am quite the novice.

I want only 1 random result, so I assume I should select
top 1 instead of the 100...would that change anything else
in the code?

Susan
-----Original Message-----
I'm not sure that typing randomize in the debug window will necessarily have
any impact on your use of the Rnd statement, but I could be wrong.

In any case, see whether the code in
http://www.mvps.org/access/queries/qry0011.htm at "The Access Web" works any
better.

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)



Some time ago I posted a question on how to randomly
sort a list of staff names for a drawing we will be
holding monthly. It seemed like it worked OK during the
test, but now when I actually went to use it, it always
brings up the same name to start. Then whenever i re- run
the query, it generates the next names in the same order.
Here's what I have:

In the query I have the fields [AutoNumber], [FirstName],
[LastName], plus the two fields with the criteria on which
the names will be filtered, both of which are filtered
with a "Yes" in the Criteria row. The query pulls data
from two tables.

Using the instructions, I also entered into the Field
row: Shuffle: Rnd([AutoNumber]) and sorted on that field.
I also typed "randomize" in the debug window prior to
running the query.

As I said, although the names appear to be random, if I
close out the database, then go back into it, put
randomize in the debug window and run the query, the same
name pops up at the top, and each time I run the query the
same rotation of names occurs. Am I missing something
from the initial instructions?

Thanks! Susan



.
.
 

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