473,714 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(How) can you pass a RecordSet reference in a OpenForm's openargs argument?

Lyn
Hi,
I have been experiencing a problem passing a LIKE statement in the WHERE
argument of a DoCmd.Openform statement. I have posted that issue
separately.

However, in an attempt to work around the problem, I thought of using
OPENARGS to pass information to the form being opened (instead of using
WHERE).

In the parent form, I have generated a RecordSet (RS) with the information
to be passed to the child form. My thought was to pass RS as the openargs
value. Of course this does not work as openargs is Variant type and RS is
an Object.

Still, is there a way to pass a reference to an existing recordset to
another form? RS was declared as Public, so is it as simple as just using
RS without further ado in the child form? (I haven't tried this yet -- it
just occurred to me as I am writing this.)

In other words, can an existing record set in one form be used in another
form and if so, how? Or does the second form have to create its own copy of
the recordset using criteria passed from the parent (which is what I am
currently having trouble with -- see separate post)?

Thanks in advance.
--
Cheers,
Lyn.
Nov 13 '05 #1
3 3886
Lyn wrote:
Hi,
I have been experiencing a problem passing a LIKE statement in the WHERE
argument of a DoCmd.Openform statement. I have posted that issue
separately.

However, in an attempt to work around the problem, I thought of using
OPENARGS to pass information to the form being opened (instead of using
WHERE).

In the parent form, I have generated a RecordSet (RS) with the information
to be passed to the child form. My thought was to pass RS as the openargs
value. Of course this does not work as openargs is Variant type and RS is
an Object.

Still, is there a way to pass a reference to an existing recordset to
another form? RS was declared as Public, so is it as simple as just using
RS without further ado in the child form? (I haven't tried this yet -- it
just occurred to me as I am writing this.)
If it's declared as public then you should be able to use it anywhere,
but for a public variable I would choose another name for it :-)
In other words, can an existing record set in one form be used in another
form and if so, how? Or does the second form have to create its own copy of
the recordset using criteria passed from the parent (which is what I am
currently having trouble with -- see separate post)?


Another way, if it's not too much trouble to open the recordset again,
is to pass rs.name in the openargs, the opened form will receive the SQL
of the recordset so will be able to open another recordset using the
same parameters.
--
This sig left intentionally blank
Nov 13 '05 #2
Lyn
Thanks Trevor. I will have a play with this and see how it goes.

I got the original problem resolved (thanks to the group), but I find that
just using the WhereCondition of OpenForm does not allow me to specify the
sort order (ORDER BY). However, using either of the two methods you
mentioned should resolve that issue.

Thanks again.

--
Cheers,
Lyn.

"Trevor Best" <no****@besty.o rg.uk> wrote in message
news:41******** *************** @news.zen.co.uk ...
Lyn wrote:
Hi,
I have been experiencing a problem passing a LIKE statement in the WHERE
argument of a DoCmd.Openform statement. I have posted that issue
separately.

However, in an attempt to work around the problem, I thought of using
OPENARGS to pass information to the form being opened (instead of using
WHERE).

In the parent form, I have generated a RecordSet (RS) with the
information to be passed to the child form. My thought was to pass RS as
the openargs value. Of course this does not work as openargs is Variant
type and RS is an Object.

Still, is there a way to pass a reference to an existing recordset to
another form? RS was declared as Public, so is it as simple as just
using RS without further ado in the child form? (I haven't tried this
yet -- it just occurred to me as I am writing this.)


If it's declared as public then you should be able to use it anywhere, but
for a public variable I would choose another name for it :-)
In other words, can an existing record set in one form be used in another
form and if so, how? Or does the second form have to create its own copy
of the recordset using criteria passed from the parent (which is what I
am currently having trouble with -- see separate post)?


Another way, if it's not too much trouble to open the recordset again, is
to pass rs.name in the openargs, the opened form will receive the SQL of
the recordset so will be able to open another recordset using the same
parameters.
--
This sig left intentionally blank

Nov 13 '05 #3
If you do this, be careful about when and where you set your Conncetion and
Recordset objects = Nothing.
Darryl Kerkeslager

"Lyn" <lh******@ihug. com.au> wrote in message
news:cr******** **@lust.ihug.co .nz...
Thanks Trevor. I will have a play with this and see how it goes.

I got the original problem resolved (thanks to the group), but I find that
just using the WhereCondition of OpenForm does not allow me to specify the
sort order (ORDER BY). However, using either of the two methods you
mentioned should resolve that issue.

Thanks again.

--
Cheers,
Lyn.

"Trevor Best" <no****@besty.o rg.uk> wrote in message
news:41******** *************** @news.zen.co.uk ...
Lyn wrote:
Hi,
I have been experiencing a problem passing a LIKE statement in the WHERE argument of a DoCmd.Openform statement. I have posted that issue
separately.

However, in an attempt to work around the problem, I thought of using
OPENARGS to pass information to the form being opened (instead of using
WHERE).

In the parent form, I have generated a RecordSet (RS) with the
information to be passed to the child form. My thought was to pass RS as the openargs value. Of course this does not work as openargs is Variant type and RS is an Object.

Still, is there a way to pass a reference to an existing recordset to
another form? RS was declared as Public, so is it as simple as just
using RS without further ado in the child form? (I haven't tried this
yet -- it just occurred to me as I am writing this.)


If it's declared as public then you should be able to use it anywhere, but for a public variable I would choose another name for it :-)
In other words, can an existing record set in one form be used in another form and if so, how? Or does the second form have to create its own copy of the recordset using criteria passed from the parent (which is what I
am currently having trouble with -- see separate post)?


Another way, if it's not too much trouble to open the recordset again, is to pass rs.name in the openargs, the opened form will receive the SQL of
the recordset so will be able to open another recordset using the same
parameters.
--
This sig left intentionally blank


Nov 13 '05 #4

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

Similar topics

3
5177
by: Don Seckler | last post by:
I have a data entry form called Draw. This form is used to enter data in the table called Draw. The table has the following fields: WholesalerID, MagID, IssueID, CopiesDist, and the index is called DrawIndex. The DrawIndex is a combination autonumber index that uses the combination of these three fields WholesalerID, MagID, IssueID to ensure that each record is unique. When a used tries to enter data that has a the same WholesalerID,...
11
1679
by: Johnny M | last post by:
I have several databases where I have one form to add a new record and one form to edit an existing record. I use unbound forms and class modules most of the time. What I would like to do is have one form that handles both adding a new record to the database and editing the same type of record. The form would be altered in the load event to change whatever needs to be changed to show the form in an "Add" mode vs. and "Edit" mode (I...
5
7081
by: GB | last post by:
Hello: In my MS Access project I have two objects - my form and my report. I need to pass variable value from Command_click procedure of my form to Report_open procedure of my report. How can I do that? I tried to declare this variable as Public in my form, but it does not work - when I reference to this variable in my report, it does not pass the value.
3
1476
by: DK | last post by:
Please can somebody help me ? I have forms named Form 1, Form 2 etc. having fields CustomerName,CustomerAddress,..... Id like to have button on each form ,which will open another form named "CustomerAdd" with list of all customers in tblCustomers. After I pick one of the customers from the list, actual form should be closed and details of customer shall be send to fields in Form 1 or Form2 or...
2
1622
by: musicloverlch | last post by:
Here is the situation: I have a main form with lots of tabs. The first tab has a subform with a lot of tabs. Each of those tabs has 1 subform. That subform contains an ID. So subsubform1 has an ID, subsubform2 has an ID up thru subsubform40. The ID on every subform is named exactly the same thing: intID. I need to put a button on each subsubform. That button opens another form based on the intID of that particular subsubform.
2
3572
by: Robert | last post by:
I have a form (frmWorksheet) that contains project information from a Projects table. The form contains a number of fields including ClientID and Project. On the form header is two combo boxes, SelectClient and SelectProject. When a user selects a client from the SelectClient combo, only the projects associated with that client will appear in the SelectProjects combo. If the user wants to add a new project to that list, they can dblclick...
37
1813
by: salad | last post by:
If one looks at job listings one will read the requirements of for it; ..Net, SQL, C#, etc. How much skill, if years experience in the discipline isn't listed, is needed. Could one simply get the C# program, read a book on it, do a "Hello World" program, and feel comfortable on the topic and apply for the job? How much knowlecge is enough, if you've got a developer background, on a new language or subject to go for it?
2
10115
by: bobh | last post by:
Hi All, In AccessXP on the main menu screen I give the user the option to open this form in either Edit or Read-Only mode. When the user chooses read-only which I use the following line DoCmd.OpenForm "frmLookupAgencyContactInfo", , , , acFormReadOnly, , strSQL
5
3996
by: jonman | last post by:
Hello, I'm a bit of a newbie when it comes to Access (and DB's in general). I've got a form that allows the assembles a SQL string (that I've tested interactively, and proven that it returns the correct records), then passes it to another form in OpenArgs using the DoCmd.OpenForm. I've verified that the newly opened form receives the SQL string, and re-tested the SQL statement to verify that that's all good. However, the recordset I'm...
0
8801
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
9314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9174
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
9074
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
9015
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...
1
6634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
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.