Dennis said:
You just pack the value strOpenArgs with you data fields. If you want to
have multiple data fields, you will have to put your own seperator in
place
(such as comma or semi-colon, etc.).
I usually pass a string along the lines of:
variable1=value1;variable2=value2;variable3=value3
so perhaps
CustName=Smith;Product=Flanges;LastOrder=2009-02-22
In the form's Load event (or even the Open event), my code will be something
like:
Dim lngLoop As Long
Dim varCurrArg As Variant
Dim varArguments As Variant
If IsNull(Me.OpenArgs) = False Then
' Split the arguments passed on the semi-colons
varArguments = Split(Me.OpenArgs, ";")
For lngLoop = LBound(varArguments) To UBound(varArguments)
' Looking at a particular argument, split on the equal sign.
varCurrArg = Split(varArguments(lngLoop), "=")
' Make sure that the argument passed is formatted correctly
' (i.e.: that it's got one equal sign in it)
If UBound(varCurrArg) = 1 Then
Select Case varCurrArg(0)
Case "CustName"
Me.CustName = varCurrArg(1)
Case "Product"
Me.Product = varCurrArg(1)
Case "LastOrder"
Me.LastOrder = varCurrArg(1)
Case Else
MsgBox "Sorry, I don't know what to do with " & _
varCurrArg(0) & " in " & Me.OpenArgs
End Select
Else
Msgbox "Invalid argument " & varArguments(lngLoop) & _
" in " & Me.OpenArgs
End If
Next lngLoop
End If