Assuming you want the result put into a text box (in this case txtResult), and you are keying in the contents of UMax and UMin you could use something like
Private Function RNum() As Integer
If Not IsNull(UMax) And Not IsNull(UMin) Then
Randomize
RNum = Int((UMax - UMin + 1) * Rnd + UMin)
End If
End Function
Private Sub UMax_AfterUpdate()
txtResult = RNum
End Sub
Private Sub UMin_AfterUpdate()
txtResult = RNum
End Sub
There are two ways to write error-free programs; only the third one works.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.