Private Sub cmdgetcode_Click()
Label1.Caption = code(4, 7)
End Sub
Private Sub Form_Load()
Randomize
End Sub
Public Function code(intMin As Integer, intMax As Integer) As String
Dim intLen As Integer
Dim lngNdx As Long
Const CHARACTERS = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
intLen = Int((intMax - intMin + 1) * Rnd + intMin)
For lngNdx = 1 To intLen
code = code & Mid$(CHARACTERS, Int((Len(CHARACTERS)) * Rnd), 1)
Next
End Function
my problem is after some clicks i get a run time error '5': Invalid procedure call or argument,
the highlighted part is
code = code & Mid$(CHARACTERS, Int((Len(CHARACTERS)) * Rnd), 1)
thanks for helping

New Topic/Question
Reply



MultiQuote




|