By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.