randomly displaing a splashscreen and

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want access to randomly pick from multiple splash screens on the start up

Also I want to display random quotes in my access database.
How would one go about this?
 
Dear GregB:

I've used a table of quotes {tblQuotes: QuoteID (Autonumber), Quote (Text)},
and the following code in the Open event of a form to populate a textbox
with a quote randomly selected from the table:

From form's Open event:

Dim lngQuoteCount As Long
lngQuoteCount = DCount("*", "tblQuotes")
Randomize
Me.txtQuote = DLookup("Quote", "tblQuotes", "[QuoteID]=" & _
Int((lngQuoteCount * Rnd) + 1))

I don't know how you would manage a randomly selected splash screen,
though...

Cheers!
Fred Boer
 
Dear GregB:

I've used a table of quotes {tblQuotes: QuoteID (Autonumber), Quote (Text)},
and the following code in the Open event of a form to populate a textbox
with a quote randomly selected from the table:

From form's Open event:

Dim lngQuoteCount As Long
lngQuoteCount = DCount("*", "tblQuotes")
Randomize
Me.txtQuote = DLookup("Quote", "tblQuotes", "[QuoteID]=" & _
Int((lngQuoteCount * Rnd) + 1))

I don't know how you would manage a randomly selected splash screen,
though...


I would use the same idea, but using form names instead of quotes.
Either place form names in a table with a unique number, or keep them
in an array in the code. If you use the array, apply the same
randomizing as above, but reference the index number of the array.

Simple Example:

Dim aryForms([maxNumber]) As String
Dim a As Integer
aryForms(0) = FormName1
aryForms(1) = FormName2
aryForms(2) = FormName3

Randomize
a=Int((maxNumber- lowerboundOfAray + 1) * Rnd + lowerboundOfAray)

DoCmd.OpenForm aryForms(a)
 

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

Back
Top