|
|
CODE Public Function myRandName() ' Generates random Names
' Code courtesy of UtterAccess Wiki ' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary ' Original submission by Mark Davis (aka: Cybercow) ' Date contributed - Aug, 11, 2010 ' ' You are free to use it in any application, ' provided this copyright notice is left unchanged. Dim nm As String, myAsc As Integer, fn, ln 10 nm = "" 20 For fn = 1 To Int(5 * Rnd + 3) ' Randomize the number of letters in first name (3 to 8 letters) 30 If fn = 1 Then 40 myAsc = Int((90 - 65 + 1) * Rnd + 65) 50 nm = Chr(myAsc) Else 70 myAsc = Int((122 - 97 + 1) * Rnd + 97) 80 nm = nm & Chr(myAsc) End If Next fn 110 nm = nm & " " 120 For ln = 1 To Int(7 * Rnd + 3) ' Randomize the number of letters in last name (3 to 10 letters) 130 If ln = 1 Then 140 myAsc = Int((90 - 65 + 1) * Rnd + 65) 150 nm = nm & Chr(myAsc) Else 170 myAsc = Int((122 - 97 + 1) * Rnd + 97) 180 nm = nm & Chr(myAsc) End If Next ln 210 myRandName = nm End Function
|
| This page was last modified 09:40, 6 April 2011. This page has been accessed 1,154 times. Disclaimers |