473,408 Members | 1,951 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

OpenArgs

How do you pass more than one argument using OpenArgs?

Nov 2 '06 #1
3 12001
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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: nic | last post by:
Hi am having difficulty understanding why the following is not working. Dim TempID As Integer Set TempID = Me.OpenArgs Knowing that OpenArgs is a string I then changed the declaration of...
11
by: Susan Bricker | last post by:
Hi. I am trying to open a form using 'openargs' parameter of the docmd.openform action. The problem is that I would like to pass the form some character (string) and integer data. My plan was to...
3
by: Tim Marshall | last post by:
I am almost certain that when I opened a form in A97 that openargs was available in that form's class module for the whole time the form was open. Apparantly this is not the case in A2003. From...
15
by: Tony Williams | last post by:
I have two forms, frma and frmb, both are for inputting new records and are based on a table, tblmonth, both have two controls, txtmonth and txtmonthlabela which are based on the fields in the...
3
by: Jim Evans | last post by:
Using code and suggestions from an earkier thread in this group, I have created the following cond for the open event of a form I am opening from the button click event of another form. ...
4
by: Barry Edmund Wright | last post by:
Hi All, I am using the code below to assign a form name to a form variable (vFrm). Is there a way to assign the Openargs string directly to vFrm, i.e. vFrm = Openargs ? Private Sub...
2
by: shumaker | last post by:
I think the problem lies in my understanding(or misunderstanding) of the scope of references. 'Code from button click event on first form: Private Sub Ok_Click() Dim strRecordSource As String...
3
by: dou | last post by:
In searching for a solution to a current problem I ran across a thread from 2005 on the same issue, ( http://www.thescripts.com/forum/thread202473.html ). In that case it appeared that the problem...
3
by: angi35 | last post by:
I'm having a zero-length string problem... Hoping someone can help. (This is in Access 2000.) In FormA, I have a button that opens FormB with OpenArgs. In FormB, the OpenArgs are translated into...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.