473,624 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Opening a form with 'openargs'

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
concatenate the data with delimeters (",") between the fields. Then in
the Form_Open( ) procedure I would parse the data and fill some "global"
variables that could be used to populate some data in the form when
there are no records (and I come up with a blank New Record). The
problem is then the integer data. Is it possible to do what I want? If
so, how?

I'm a mainframe programmer who dabbles in MS/Access and VBA for fun and
I'm trying to put together a utility that some of us here at work can
use to keep track of 'tasks' within a 'project' within a 'release of
software'. This way those of us who do 'Release Management' could
generate all the reports (and excel spreadsheets) that are asked of us.
The only problem ... I have to get it working before I show it to my
bosses.

Any suggestions? Or Questions? I'll gladly get more specific if you
need. Just ask away.

Thanks.
Sue


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
11 6025
A better way to do this might be to only pass the string via OpenArgs and then
put a multiselect listbox on your first form where the users can select the
Integer data and then pass the Integer data to the second form from the listbox.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Susan Bricker" <sb****@att.net > wrote in message
news:40******** *************@n ews.frii.net...
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
concatenate the data with delimeters (",") between the fields. Then in
the Form_Open( ) procedure I would parse the data and fill some "global"
variables that could be used to populate some data in the form when
there are no records (and I come up with a blank New Record). The
problem is then the integer data. Is it possible to do what I want? If
so, how?

I'm a mainframe programmer who dabbles in MS/Access and VBA for fun and
I'm trying to put together a utility that some of us here at work can
use to keep track of 'tasks' within a 'project' within a 'release of
software'. This way those of us who do 'Release Management' could
generate all the reports (and excel spreadsheets) that are asked of us.
The only problem ... I have to get it working before I show it to my
bosses.

Any suggestions? Or Questions? I'll gladly get more specific if you
need. Just ask away.

Thanks.
Sue


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2
OpenArgs is pretty limited. Yes, you can concatenate strings, then parse them
back out, but then there's a good chance you'll soon want more, and the string
lenght is in danger of exceeding the maximum for OpenArgs.

What I've started doing is to make a global collection variable called
gcolPassArgs. Before opening a form or report to which I want to pass
arguments, I create a colleciton of arguments, and place it in the global
variable. In Open event for the form or report, grab the collection from the
globable variable, then process its contents. It is important to fully read
the colleciton or copy it to a private reference variable in the Open event
handler since other code may rewrite the data at any time in order to pass
arguments to some other form or report.

In a standard module somewhere...

Dim gcolPassArgs As VBA.Collection

In the code that opens the form...

Dim colFormParams As VBA.Collection
Set colFormParams = New VBA.Collection
colFormParams.A dd Key:="Arg1", Item:="ABCD"
colFormParams.A dd Key:="Arg2", Item:=123
Set gcolPassArgs = colFormParams
DoCmd.OpenForm "frmFoo"
In frmFoo...

Private Sub Form_Open(Cance l As Integer)
Me!txtData1 = gcolPassArgs("A rg1")
Me!txtData2 = gcolPassArgs("A rg2")
End Sub
On 24 Feb 2004 18:08:41 GMT, Susan Bricker <sb****@att.net > wrote:
Hi. I am trying to open a form using 'openargs' parameter of the
docmd.openfo rm action. The problem is that I would like to pass the
form some character (string) and integer data. My plan was to
concatenate the data with delimeters (",") between the fields. Then in
the Form_Open( ) procedure I would parse the data and fill some "global"
variables that could be used to populate some data in the form when
there are no records (and I come up with a blank New Record). The
problem is then the integer data. Is it possible to do what I want? If
so, how?

I'm a mainframe programmer who dabbles in MS/Access and VBA for fun and
I'm trying to put together a utility that some of us here at work can
use to keep track of 'tasks' within a 'project' within a 'release of
software'. This way those of us who do 'Release Management' could
generate all the reports (and excel spreadsheets) that are asked of us.
The only problem ... I have to get it working before I show it to my
bosses.

Any suggestions? Or Questions? I'll gladly get more specific if you
need. Just ask away.

Thanks.
Sue


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 12 '05 #3
Susan Bricker wrote:
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
concatenate the data with delimeters (",") between the fields. Then in
the Form_Open( ) procedure I would parse the data and fill some "global"
variables that could be used to populate some data in the form when
there are no records (and I come up with a blank New Record). The
problem is then the integer data. Is it possible to do what I want? If
so, how?

I'm a mainframe programmer who dabbles in MS/Access and VBA for fun


Good practice.

Why is integer a problem? Act as if it is a string (during its OpenArgs
voyage) and then convert the string into an integer using implicit or
explicit type conversion (does implicit not work? Never mind then) See
Int() CInt() CLng()

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #4
Susan Bricker wrote:

and Val() of course
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #5
Steve Jorgensen wrote:
OpenArgs is pretty limited. Yes, you can concatenate strings, then parse them
back out, but then there's a good chance you'll soon want more, and the string
lenght is in danger of exceeding the maximum for OpenArgs.

What I've started doing is to make a global collection variable called
gcolPassArgs.
I even use a special table for this. Of course global variables do not
die in a normally running application, but they will die on error (some
errors?)

I think there is an article about that on my site... yes,
articles:public variables.

Before opening a form or report to which I want to pass arguments, I create a colleciton


happy to see you have the same 'type timing' as I :-)

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #6
On Tue, 24 Feb 2004 20:04:30 +0100, Bas Cost Budde <ba*@heuveltop. org> wrote:
Steve Jorgensen wrote:
OpenArgs is pretty limited. Yes, you can concatenate strings, then parse them
back out, but then there's a good chance you'll soon want more, and the string
lenght is in danger of exceeding the maximum for OpenArgs.

What I've started doing is to make a global collection variable called
gcolPassArgs.
I even use a special table for this. Of course global variables do not
die in a normally running application, but they will die on error (some
errors?)


They die if you ever stop the code in debug mode. In this code, the global
variable is only used briefly to transfer the data from one procedure to
another, so the fragility of global data is not a big issue.

I think there is an article about that on my site... yes,
articles:publi c variables.

Before opening a form or report to which I want to pass
arguments, I create a colleciton


happy to see you have the same 'type timing' as I :-)


<g>
Nov 12 '05 #7

"Steve Jorgensen" wrote
OpenArgs is pretty limited. Yes, you can
concatenate strings, then parse them
back out, but then there's a good chance
you'll soon want more, and the string
lenght is in danger of exceeding the maximum
for OpenArgs.


Strangely, perhaps, I have never come close to having to pass enough data
via OpenArgs to ever, even remotely, fear that I might one day exceed the
maximum. We must design applications differently.

Larry Linson
Microsoft Access MVP
Nov 12 '05 #8
On Thu, 26 Feb 2004 02:34:38 GMT, "Larry Linson" <bo*****@localh ost.not>
wrote:

"Steve Jorgensen" wrote
OpenArgs is pretty limited. Yes, you can
concatenate strings, then parse them
back out, but then there's a good chance
you'll soon want more, and the string
lenght is in danger of exceeding the maximum
for OpenArgs.


Strangely, perhaps, I have never come close to having to pass enough data
via OpenArgs to ever, even remotely, fear that I might one day exceed the
maximum. We must design applications differently.

Larry Linson
Microsoft Access MVP


I have, on occasion, needed to pass SQL statements to forms, and these can
easily become long. In one application, the user first enters a large amount
of data about how to translate data, moving it from one database to another,
then another form manages pre-checking the data, executing the operation, and
reporting the results. I pretty much had to make a custom class to
encapsulate the data to pass, and I had to use a global variable to pass it.

Besides all that, to me the inelegance of using a global variable to pass data
is less than the inelegance of concatenating a bunch of arguments into a
string, then parsing them back out. They're both inelegant, but the parsing
relies on more code working properly and more constraints being met to work
correctly. Regarding the string length, just because it's not exceeded during
testing, can we ensure that it won't be exceeded during production? There are
just fewer concerns to worry about with the global variable.
Nov 12 '05 #9
I most often use OpenArgs to pass very minor amounts of data -- it never has
occurred to me to use them for user-entered information that could be
essentially unlimited in length or for passing SQL statements. So, maybe
it's just that I instinctively did NOT use OpenArgs for those, rather than
never had the need to pass anything that long.

I am of the "old school" that "has no great fear" of judiciously-used global
variables -- after all, in one or two of my programming incarnations, I
worked in eras when that's all there was for interroutine communication.
I've never seen the "horde of slavering, foaming-at-the-mouth programmers
just waiting to pounce on and corrupt a poor unprotected global" that some
seem to fear. A class for which a new object can be instantiated, or an
entry in an array of UDT's, is a good answer to the longer stuff, for those
who have seen the "Slavering Horde", though.

Larry Linson
Microsoft Access MVP
"Steve Jorgensen" <no****@nospam. nospam> wrote in message
news:9g******** *************** *********@4ax.c om...
On Thu, 26 Feb 2004 02:34:38 GMT, "Larry Linson" <bo*****@localh ost.not>
wrote:

"Steve Jorgensen" wrote
OpenArgs is pretty limited. Yes, you can
concatenate strings, then parse them
back out, but then there's a good chance
you'll soon want more, and the string
lenght is in danger of exceeding the maximum
for OpenArgs.
Strangely, perhaps, I have never come close to having to pass enough data
via OpenArgs to ever, even remotely, fear that I might one day exceed the
maximum. We must design applications differently.

Larry Linson
Microsoft Access MVP


I have, on occasion, needed to pass SQL statements to forms, and these can
easily become long. In one application, the user first enters a large

amount of data about how to translate data, moving it from one database to another, then another form manages pre-checking the data, executing the operation, and reporting the results. I pretty much had to make a custom class to
encapsulate the data to pass, and I had to use a global variable to pass it.
Besides all that, to me the inelegance of using a global variable to pass data is less than the inelegance of concatenating a bunch of arguments into a
string, then parsing them back out. They're both inelegant, but the parsing relies on more code working properly and more constraints being met to work correctly. Regarding the string length, just because it's not exceeded during testing, can we ensure that it won't be exceeded during production? There are just fewer concerns to worry about with the global variable.

Nov 12 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1928
by: Not Me | last post by:
Hi, I'm opening one form from another, passing the criteria through using OpenArgs (this works correctly - I have tested with a msgbox). The problem is with the findfirst method, I get the syntax error 'missing operator in expression' on line 2 of the following: If Len(Me.OpenArgs) Then Me.RecordsetClone.FindFirst "campaign = " & Me.OpenArgs If Not Me.RecordsetClone.NoMatch Then Me.Bookmark = Me.RecordsetClone.Bookmark
3
2017
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. Private Sub Form_Open(Cancel As Integer) If Len(Me.OpenArgs & "") > 0 Then Dim i As Integer Dim s As String
3
1795
by: cjay85 | last post by:
I have two forms - 'Application' and 'User'. Within both the 'User' and 'Application' forms I have a field called 'ID Number'. I want to be able to open up the Application form from the User form. When I do open this I want the ID number field in Application to be the value that was in the ID Number field on the record I was viewing in the User form.
1
2152
by: Kevin Nechodom | last post by:
I am trying to use a consolidated filter form, where I pass the desired report I wish to run. I would like to install this form on my custom menu bars, but I can't figure out any way to pass data to the form via the menu. I have looked for a RunCode menu type, where I could use DoCmd. I have tried the form type, but I can't access OpenArgs. Are there any other ideas out there? Thanks,
4
7099
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 Form_Load() Public vFrm As Form If Openargs = "subfrmProjects" then
7
12246
by: sara | last post by:
I have a form where the user selects an item from a list box, and then works on that item. The user chooses an AD, then opens a form to assign departments to the ad. The top of the Depts form has a combo box, to select an ad from the drop down list. I would like the Depts form to open with the Ad selected on the Main form displaying in the combo box, AND any information already added presented to the user. (I am thinking this latter...
3
9179
by: MartinR | last post by:
Hi, I'm still new to writing code in vba as I've only been introduced to access three weeks ago. I have written this code below and it executes but does not do what I want it to do. What I want is the form "Sparesform" to open when I double click on the "index" field for the record I wish to view. The index field is part of a subform. What is happening at the moment is the form "Sparesform" is opening but does not go to the correct record...
10
15317
by: sara | last post by:
Hi - I have been struggling with solution ideas for this now for almost 2 weeks, and have not been able to figure this out. I have a user who creates a Purchase Order (tblPOData). In some circumstances, this or another user must create an invoice to go with the PO (I know - that makes no sense, but this is the business case). I have the user go to a form to create the invoice:
4
1805
by: dantebothermy | last post by:
Hi friends, I want a script that will move a form to a chosen record. Here's what I'm trying: I get the parameter from la different form using Docmd,openform using openargs I've been trying docmd.gotocontrol followed by docmd.findrecord, but I keep getting complier errors. Here's my code:
0
8251
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8182
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8352
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8494
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5570
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1496
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.