OpenArgs, two parameters

TanisAgain

David
Local time
Today, 13:26
Joined
Feb 21, 2006
Messages
69
I have used the OpenArgs method to pass a parameter to another form, but I now need to psss two parameters, and I am not sure how to do this.

On Error GoTo Err_CmdOpenForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmName"
DoCmd.OpenForm stDocName, , , , , , Me.Text0 'need to pass another
'Parameter Me.Text1
Exit_CmdOpenForm_Click:
Exit Sub

Err_CmdOpenForm_Click:
MsgBox Err.Description
Resume Exit_CmdOpenForm_Click

And on the Load event of frmName, Me.Text1 = Me.OpenArgs 'and Me.Text2
 
Generally speaking, you'll need to concatenate them together:

Value1;Value2

and in the receiving form parse them back out using the Split function or string functions (InStr, Left, Mid...).
 
alternatively save the args in global variables, and test them in the forms open or load event
 
You can do it like this :

I personally do not like using openargs unless I have to, and creating global variables is not considered good practice.

You would be better off creating custom properties in your "other" form which represent the variables you want to transfer, you can then transfer the values directly to your other form.
 

Users who are viewing this thread

Back
Top Bottom