R
Ripper
I am trying to use a code I got from the board to display a random day of the week in an unbound textbox. I tried to change the code a bit, but I have NEGATIVE skill in this catagory. The line I marked with an arrow keeps getting an error and I tried everything I can think of. Anyone able to help
Thanks As Always
RI
Private Sub Form_Load(
'Highest form numbe
Const lngcUpperBound =
'Lowest form numbe
Const lngcLowerBound =
Dim lngFormNumber As Lon
Dim strDayofWeek As Strin
'Requires reference to Microsoft DAO 3.6 Object Library (or 3.51 for Access 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 randomnumber
Set db = CurrentD
--> Set rst = db.OpenRecordset("SELECT [Day] FROM tblDaysofWeek WHERE [Day] = " & lngFormNumber) <--- Error HER
strDayofWeek = rst.Fields("Day"
rst.Close
Thanks As Always
RI
Private Sub Form_Load(
'Highest form numbe
Const lngcUpperBound =
'Lowest form numbe
Const lngcLowerBound =
Dim lngFormNumber As Lon
Dim strDayofWeek As Strin
'Requires reference to Microsoft DAO 3.6 Object Library (or 3.51 for Access 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 randomnumber
Set db = CurrentD
--> Set rst = db.OpenRecordset("SELECT [Day] FROM tblDaysofWeek WHERE [Day] = " & lngFormNumber) <--- Error HER
strDayofWeek = rst.Fields("Day"
rst.Close