A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Passing an array parameter to forms Open Event



 
 
Thread Tools Display Modes
  #1  
Old February 3rd, 2010, 12:15 PM posted to microsoft.public.access.forms
Arvi Laanemets
external usenet poster
 
Posts: 397
Default Passing an array parameter to forms Open Event

Hi

When opening a form using DoCmd.Openform method, the last parameter can be
used to pass a parameter to form's Open event. My question is, can this
parameter be an array? I need to send 3 different values (a string, an
integer and a date) to form. Of course I can create a text string formatted
accordingly and then in forms Open event initialize 3 different variables
from it, but is there an easier way. (My application must be compatible with
Access2000.)
I searched and did find out, that for functions/procedures is it possible to
pass an array as parameter. What about Form and it's OpenArgs property?


Thanks in advance!
Arvi Laanemets

  #2  
Old February 3rd, 2010, 01:47 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Passing an array parameter to forms Open Event

OpenArgs is a string, but you can use a separator, like a comma, and parse
out that string and covert convert each element to anything that will work.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Arvi Laanemets" wrote in message
...
Hi

When opening a form using DoCmd.Openform method, the last parameter can be
used to pass a parameter to form's Open event. My question is, can this
parameter be an array? I need to send 3 different values (a string, an
integer and a date) to form. Of course I can create a text string
formatted accordingly and then in forms Open event initialize 3 different
variables from it, but is there an easier way. (My application must be
compatible with Access2000.)
I searched and did find out, that for functions/procedures is it possible
to pass an array as parameter. What about Form and it's OpenArgs property?


Thanks in advance!
Arvi Laanemets



  #3  
Old February 4th, 2010, 01:13 AM posted to microsoft.public.access.forms
David W. Fenton
external usenet poster
 
Posts: 3,373
Default Passing an array parameter to forms Open Event

"Arvin Meyer [MVP]" wrote in
:

OpenArgs is a string, but you can use a separator, like a comma,
and parse out that string and covert convert each element to
anything that will work.


And, of course, you can use Join() to convert data stored in an
array into a string for passing as an OpenArg, and then use Split()
to reconstitute it in the receiving form.

I wouldn't actually ever *do* that, but it's possible.

And, of course, it's limited to a 1 dimensional array.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
  #4  
Old February 4th, 2010, 02:59 PM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default Passing an array parameter to forms Open Event


"David W. Fenton" wrote in message
36.90...
"Arvin Meyer [MVP]" wrote in
:

OpenArgs is a string, but you can use a separator, like a comma,
and parse out that string and covert convert each element to
anything that will work.


And, of course, you can use Join() to convert data stored in an
array into a string for passing as an OpenArg, and then use Split()
to reconstitute it in the receiving form.


Yes that's one way to parse.

I wouldn't actually ever *do* that, but it's possible.


I've never had a need to do it, but I see nothing wrong with the technique.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


  #5  
Old February 5th, 2010, 03:42 AM posted to microsoft.public.access.forms
David W. Fenton
external usenet poster
 
Posts: 3,373
Default Passing an array parameter to forms Open Event

"Arvin Meyer [MVP]" wrote in
:


"David W. Fenton" wrote in message
36.90...
"Arvin Meyer [MVP]" wrote in
:

OpenArgs is a string, but you can use a separator, like a comma,
and parse out that string and covert convert each element to
anything that will work.


And, of course, you can use Join() to convert data stored in an
array into a string for passing as an OpenArg, and then use
Split() to reconstitute it in the receiving form.


Yes that's one way to parse.

I wouldn't actually ever *do* that, but it's possible.


I've never had a need to do it, but I see nothing wrong with the
technique.


I believe that using OpenArgs to pass more than one piece of
information to a form indicates a design error. It's better to use a
data structure independent of the calling and called forms, because
otherwise, the dependencies can be extremely difficult to
troubleshoot. I would tend to use a standalone class module.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
  #6  
Old February 5th, 2010, 07:11 AM posted to microsoft.public.access.forms
Arvi Laanemets
external usenet poster
 
Posts: 397
Default Passing an array parameter to forms Open Event

Hi

I did find out about this soon after I posted my question here. Googling for
'openargs' did the trick.


Arvi Laanemets.


"Arvin Meyer [MVP]" kirjutas sõnumis news:
...
OpenArgs is a string, but you can use a separator, like a comma, and parse
out that string and covert convert each element to anything that will
work.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"Arvi Laanemets" wrote in message
...
Hi

When opening a form using DoCmd.Openform method, the last parameter can
be used to pass a parameter to form's Open event. My question is, can
this parameter be an array? I need to send 3 different values (a string,
an integer and a date) to form. Of course I can create a text string
formatted accordingly and then in forms Open event initialize 3 different
variables from it, but is there an easier way. (My application must be
compatible with Access2000.)
I searched and did find out, that for functions/procedures is it possible
to pass an array as parameter. What about Form and it's OpenArgs
property?


Thanks in advance!
Arvi Laanemets



  #7  
Old February 5th, 2010, 07:30 AM posted to microsoft.public.access.forms
Arvi Laanemets
external usenet poster
 
Posts: 397
Default Passing an array parameter to forms Open Event

I have a special case here. I need to call same popup form from a couple of
other forms to make some operations (editing, adding or deleting) on several
records of certain table at one go (the table connects employees with
operations on objects at some time moment). And it depends on calling form,
which set of records it is - so I use OpenArgs to initialize the popup form.


Arvi Laanemets



"David W. Fenton" kirjutas sõnumis news:
...
"Arvin Meyer [MVP]" wrote in
:


"David W. Fenton" wrote in message
36.90...
"Arvin Meyer [MVP]" wrote in
:

OpenArgs is a string, but you can use a separator, like a comma,
and parse out that string and covert convert each element to
anything that will work.

And, of course, you can use Join() to convert data stored in an
array into a string for passing as an OpenArg, and then use
Split() to reconstitute it in the receiving form.


Yes that's one way to parse.

I wouldn't actually ever *do* that, but it's possible.


I've never had a need to do it, but I see nothing wrong with the
technique.


I believe that using OpenArgs to pass more than one piece of
information to a form indicates a design error. It's better to use a
data structure independent of the calling and called forms, because
otherwise, the dependencies can be extremely difficult to
troubleshoot. I would tend to use a standalone class module.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:00 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.