odd question (abt opening random forms)

  • Thread starter Thread starter _Bigred
  • Start date Start date
B

_Bigred

I am creating a db in access 2000, with many guitar playing forms.

I would like to randomly open one of the many forms I have in the db, and
have a button on the form(s) that open that would open the next form
randomly.

The intent is to make the practice items random everyday.

frmAPENTATONIC
frmBLUESSCALE
frmSTRUMPATTERNS
frmOPENCHORDS
frmTHEORY
frmLEARNSONG1
frmLEARNSONG2

Any ideas would be appreciated,
_Bigred
 
1. Create a new query.

2. Switch to SQL View (View menu).

3. Paste in this statement:
SELECT TOP 1 MSysObjects.Name AS FormName FROM MSysObjects
WHERE ((MSysObjects.Name Not Like "~*") AND (MSysObjects.Type = -32768))
ORDER BY Rnd([Id]);

4. Save the query with the name qryRandomForm

5. In your application's startup code include the statment:
Randomize

6. Whenever you want to open a random form:
DoCmd.OpenForm DLookup("FormName", "qryRandomForm")
 
Back
Top