Not that often, but often enough, i pass several variables to a form through open arguments.
And thought i could streamline the retrieval of them through a simple snippet of reusable code.
(I "think" the answer is you can't do what i'm trying to do... but....)
the problem is defining a variable for each argument (sometimes there is only 1; other times, there may be several (maybe 3 or 4 or 5)
the arguments then get assigned to controls on the form..
here's the code:
Code:
Private Sub Form_Load()
If Len(Me.OpenArgs) > 0 Then
strOpenArgs = Me.OpenArgs
intVarCnt = 1
Do While InStr(strOpenArgs, "|") <> 0
strVar = srtVar & intVarCnt
intPos = InStr(strOpenArgs, "|")
strVar = Left(Me.OpenArgs, intPos - 1)
strOpenArgs = Mid(strOpenArgs, intPos + 1)
intVarCnt = intVarCnt + 1
Loop
' and then pickup the last argument (after the last pipe)
strVar = "var" & intVarCnt
intPos = InStr(strOpenArgs, "|")
strVar = Left(Me.OpenArgs, intPos - 1)
strOpenArgs = Mid(strOpenArgs, intPos + 1)
End If
End Sub
as always, with appreciation in advance,
thnx,
m.