Random Message

  • Thread starter Thread starter ake
  • Start date Start date
I would put various tips and quotes in a database that I created. I want one
of these "quote" or "tip" to be displayed once the starting form is opened.
 
You could create a small table to store the messages like;

tblDisplayMessages
**************
MessageID (Autonumber PK)
MessageText (Text data type)


Then create the following query to select one random record at a
time from the table;

SELECT TOP 1 Rnd([MessageID]) AS Expr1, MessageText
FROM tblDisplayMessages
ORDER BY Rnd([MessageID])

As far as displaying the messages, you would need to display them
in a separate pop up form, or perhaps a small subform within
another form, using the query as the record source for the pop up
form (or the subform).
 
Thanks, I have created a query that randomly select a "quote" from a table. I
also made it appear in a startup form.My problem is that whenever I open the
form the same message appears. I want a different message whenever I open the
form. Please help me do this. I know I'm missing just one thing here and I
can't figure it out.
I entered the following SQL in my table:

SELECT TOP 1 [tblQuotes].[Message], Rnd([Auto]) AS Expr1
FROM tblQuotes
ORDER BY Rnd([Auto]);

Beetle said:
You could create a small table to store the messages like;

tblDisplayMessages
**************
MessageID (Autonumber PK)
MessageText (Text data type)


Then create the following query to select one random record at a
time from the table;

SELECT TOP 1 Rnd([MessageID]) AS Expr1, MessageText
FROM tblDisplayMessages
ORDER BY Rnd([MessageID])

As far as displaying the messages, you would need to display them
in a separate pop up form, or perhaps a small subform within
another form, using the query as the record source for the pop up
form (or the subform).
--
_________

Sean Bailey


ake said:
I would put various tips and quotes in a database that I created. I want one
of these "quote" or "tip" to be displayed once the starting form is opened.
 
Back
Top