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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|