On 2 Nov 2006 06:15:15 -0800, Tanis wrote:
How do you pass more than one argument using OpenArgs?
Assuming you are using a newer version of Access that includes the
Split() function (Access 2000 or newer):
First Copy and Paste the following Function into a Module:
Public Function ParseText(TextIn As String, x) As Variant
On Error Resume Next
Dim Var As Variant
Var = Split(TextIn, "|", -1)
ParseText = Var(x)
End Function
========
To pass the multiple OpenArgs when opening the second form use the
vertical line "|" as text separator.
DoCmd.OpenForm "FormName", , , , , , "Hello|GoodBy|Mary|Lamb"
===========
Code the Load event of that second form:
If Not IsNull(Me.OpenArgs) Then
Dim strA As String
Dim strB As String
Dim strC As String
Dim strD As String
strA = ParseText(OpenArgs, 0)
strB = ParseText(OpenArgs, 1)
strC = ParseText(OpenArgs, 2)
strD = ParseText(OpenArgs, 3)
' Then do what you want with the resulting strings
MsgBox "The OpenArgs are:" & vbNewLine & strA & " " & strB &
vbNewLine & strC & " " & strD
End If
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail