By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,916 Members | 1,317 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,916 IT Pros & Developers. It's quick & easy.

OpenArgs

P: n/a
How do you pass more than one argument using OpenArgs?

Nov 2 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 2 Nov 2006 06:15:15 -0800, "Tanis" <dn*****@accuride.comwrote:

You can pass only one string, but that string can be anything.
Personally I always pass a querystring-like argument, e.g.:
"CustomerID=5&JobID=20"
I've written functions that can parse querystrings, so they become
easy to work with.

-Tom.

>How do you pass more than one argument using OpenArgs?
Nov 2 '06 #2

P: n/a
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
Nov 2 '06 #3

P: n/a

fredg wrote:
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
========
Thanks folks Just what the doctor ordered!
>
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
Nov 3 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.