How can I select a random record from a column?

G

Guest

I am trying to design a simple table that will produce a random message,
based on five variable columns.

I want each of following fields to be selected randomly from a query, each
time a button is pressed: noun1, superlative, verb, adjective, noun2.

The returned individual message would be:

Your [noun1] is [superlative] than my [verb] [adjective] noun2.

I am happy with concatenations, but cannot for the life of me work out the
random record selection command. Any ideas?
 
M

[MVP] S.Clark

Sounds like a way cool homework assignment. High school or College?

If you haven't already, checkout the Rnd() function in the help file. If
each of the words has a unique id, then you can generate a random number
between the highest and lowest WordID values, and have that word selected.
This would need to be done within each category or for each table, or
however you have it setup.

This can probably be done within one or two queries, maybe more, but I would
head the VBA route, unless the teacher as instructed you otherwise. ??
 

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