R
Ripper
I am using the following code to open a random for from a list of forms in tblFormList
Private Sub Command0_Click(
'Highest form numbe
Const lngcUpperBound =
'Lowest form numbe
Const lngcLowerBound =
Dim lngFormNumber As Lon
Dim strFormName As Strin
'Requires reference to Microsoft DAO 3.6 Object Library (or 3.51 forAccess 97)
Dim db As DAO.Databas
Dim rst As DAO.Recordse
'Generate a random number in the specified range. See 'Rnd Function' in the help file for details
Randomize Time
lngFormNumber = Int((lngcUpperBound - lngcLowerBound + 1) * Rnd + lngcLowerBound
'Open a recordset to get the form name corresponding to the random number
Set db = CurrentD
Set rst = db.OpenRecordse("SELECT FormName FROM tblFormList WHERE FormNumber = " & lngFormNumber
strFormName = rst.Fields("FormName"
rst.Clos
'Open the form
DoCmd.OpenForm strFormNam
I get an error of a user defined-type not defined when running the following lines
Dim db As DAO.Databas
Dim rst As DAO.Recordse
This is code I received on this newgroup, thanks to Brendan Reynolds for his help. Anyone have any idea how to fix the error I am running Access '02 on windows 2000
Thanks As Always
RIP
Private Sub Command0_Click(
'Highest form numbe
Const lngcUpperBound =
'Lowest form numbe
Const lngcLowerBound =
Dim lngFormNumber As Lon
Dim strFormName As Strin
'Requires reference to Microsoft DAO 3.6 Object Library (or 3.51 forAccess 97)
Dim db As DAO.Databas
Dim rst As DAO.Recordse
'Generate a random number in the specified range. See 'Rnd Function' in the help file for details
Randomize Time
lngFormNumber = Int((lngcUpperBound - lngcLowerBound + 1) * Rnd + lngcLowerBound
'Open a recordset to get the form name corresponding to the random number
Set db = CurrentD
Set rst = db.OpenRecordse("SELECT FormName FROM tblFormList WHERE FormNumber = " & lngFormNumber
strFormName = rst.Fields("FormName"
rst.Clos
'Open the form
DoCmd.OpenForm strFormNam
I get an error of a user defined-type not defined when running the following lines
Dim db As DAO.Databas
Dim rst As DAO.Recordse
This is code I received on this newgroup, thanks to Brendan Reynolds for his help. Anyone have any idea how to fix the error I am running Access '02 on windows 2000
Thanks As Always
RIP