I need help tying these two functions together, I thought I had tried everything, but I guess not since it still doesn't work. The first function actually chooses the random number and the second is going to let me choose how many numbers. So what I need is how many random numbers to choose. All help would be appreciated.
Public Function SetTmpRandNbr()
Dim rs As Recordset
Dim SQLcmd As String
Dim db As Database
Set db = CurrentDb()
SQLcmd = "SELECT * FROM Random ORDER BY TOID"
Set rs = db.OpenRecordset(SQLcmd, dbOpenDynaset)
With rs
Do Until .EOF
.Edit
!TmpRandNbr = Rnd()
.Update
.MoveNext
Loop
.Close
End With
Set rs = Nothing
End Function
-----------------
Sub Yadda()
Dim varResponse As Variant
varResponse = InputBox("Please enter the % of records " _
& "you would like to view.", "Percent to View"
If Nz(varResponse) = "" Then
'Do nothing.
ElseIf IsNumeric(varResponse) Then
'Run your code here, using varResponse in place of
'the random number you were generating.
Else
Call MsgBox("That's not a number."
Call Yadda
End If
End Sub
Public Function SetTmpRandNbr()
Dim rs As Recordset
Dim SQLcmd As String
Dim db As Database
Set db = CurrentDb()
SQLcmd = "SELECT * FROM Random ORDER BY TOID"
Set rs = db.OpenRecordset(SQLcmd, dbOpenDynaset)
With rs
Do Until .EOF
.Edit
!TmpRandNbr = Rnd()
.Update
.MoveNext
Loop
.Close
End With
Set rs = Nothing
End Function
-----------------
Sub Yadda()
Dim varResponse As Variant
varResponse = InputBox("Please enter the % of records " _
& "you would like to view.", "Percent to View"
If Nz(varResponse) = "" Then
'Do nothing.
ElseIf IsNumeric(varResponse) Then
'Run your code here, using varResponse in place of
'the random number you were generating.
Else
Call MsgBox("That's not a number."
Call Yadda
End If
End Sub