My OS is win 7 prof 64 bit and i use Office 365 and Access 2013.
in Access 2013, I have a Form, which has the following code under a command button :
Private Sub Command29_Click()
Dim torandom As String
torandom = "1234TqRi*(Ka"
MsgBox "this is what the string to randomize looks like before being randomized : " & torandom
The Function, RandomiseString is created in the Module, and it is as follows :
Public Function RandomiseString(inputString) As String
Dim mystr As String
Dim myStrLen As Integer
Dim random_number As Integer
mystr = inputString
myStrLen = Len(inputString)
resultstring = ""
Do Until Len(resultstring) = myStrLen
random_number = Int(Len(mystr) * Rnd) + 1
resultstring = resultstring & Mid(mystr, random_number, 1)
mystr = Left(mystr, random_number - 1) & Right(mystr, Len(mystr) - random_number)
'RandomiseString = resultstring
glbconverted = resultstring
MsgBox "This is INSIDE the function of the glbconverted" & glbconverted
i would like to return the result from the function to the calling Procedure, but i do not know how to do it. And also where do I declare the variables in the Function. I tried in the Module, but the procedure does not see it. So looks like i am not doing things right.
Please let me know where I should create the variable that will have its scope in the entire access program, and what is the syntax.
how does the function, return the result to a variable, that will be visible outside this function?
As i was experimenting, thus, please correct my code as necessary. Thank u for your advice.