473,499 Members | 1,669 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 3864
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.org.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.org.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
5165
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...
11
1660
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...
5
7068
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...
3
1458
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...
2
1608
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...
2
3558
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,...
37
1783
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...
2
10089
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 ...
5
3978
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...
0
7180
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,...
1
6905
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...
0
7395
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...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
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...
0
4609
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...
0
3108
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...
0
1429
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 ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.