Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to feed multiple Openargs to a second form

Status
Not open for further replies.

DaOtH

Technical User
Jan 22, 2002
114
SE
Hi All,

I am building a combination of forms for which i use OpenArgs to pass data from one form to another.

Thing i need to do right now is pass more than one variable to the second form. I assume that it is possible to transport more than one variable but i haven't succeeded in this and the Access help is not really helping out either.

Anybody any idea's ?

"In three words I can sum up everything I've learned about life: it goes on."
- Robert Frost 1874-1963
 
You can only pass one OpenArgs argument. So you have to get creative, here are a fre options:-

A) Place the parameters that you want to pass into non-visible contols, with standard control names, on each of the calling forms and then just the name of the calling form in the OpenArgs parameter. Then the newly opened for can get the values by looking at the calling form - as in:-
Form2Param1Variable = Forms!CallingForm!ControlNamesForParam1

B) Place the parameters that you want to pass into global variables.

C) Concatenate the values along with identifiers into a text string and pass the complete string. Then parse the string on the newly opened form.
Eg
Dim strDemoArgs as String
strDemoArgs = "Param1=" & FirstValue & ";Param2= & SecondValue & ";etc.. .. "

D) Define an Array of Variants, Populate the array in a predefined way and then pass the Array variable as the OpenArg.

D2) Define an Array of Variants and an Array of Strings ( Or you could use a 2 x nn array of variants ), populate the array in any old order with the values and populate the string array in the same order with the variant's lables/descriptor/name.



Are any of these applicable to you application?

G LS
 
Yep,

I already thought of B and C myself.
A is a bit the wrong way around since i need to pass information returned from some functions and not just information entered.

D sounds quite nice as well.... worth a try.

I hoped i could simply use something like OpenArg1, Openarg2 etc but as i see no straightforward chance on that.

Thanx anyway,
Arjan "In three words I can sum up everything I've learned about life: it goes on."
- Robert Frost 1874-1963
 
Still another is to create a data channel into the form by inserting a new property, call it whatever. Then you can perform whatever actions you want on the strings when they are passed to the property from the other form.

From Any other open form
Forms("Form1").Whatever = AStringOfDataToGoToForm1

Public Property Let Whatever(CatchString As String)

If CatchString = Something Then
Do Something Else
End If

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top