Subform recordset

G

Guest

Access 2003

I would like to use the recordset of a subform from a different form.
Both forms will be loaded.
I will be using the recordset as Read Only (no changes to the records of the
first form)

This is what I'd like to do
Dim rstDA As DAO.Recordset
If CurrentProject.AllForms.Item("D A").IsLoaded Then
Set rstDA = Forms![D A]![DA Subform].Recordset
End If

However the subform doesn't have a Recordset property
I'm looking at one of the fields in the DA form to filter the second form.

Thanks for any help,
James Deckert
 
G

Guest

I left off the final .form prior to .Recordset.
So I think I've got it working.

thanks
James
 
M

Marshall Barton

JamesDeckert said:
Access 2003

I would like to use the recordset of a subform from a different form.
Both forms will be loaded.
I will be using the recordset as Read Only (no changes to the records of the
first form)

This is what I'd like to do
Dim rstDA As DAO.Recordset
If CurrentProject.AllForms.Item("D A").IsLoaded Then
Set rstDA = Forms![D A]![DA Subform].Recordset
End If

However the subform doesn't have a Recordset property


The subform CONTROL is the container for the form object
being displayed as a subform so it can only be used as a
stepping stone on your way to the (sub)form's properties.

If you do not want to affect the form's current record, then
you should use the RecordsetClone instead of Recordset:

Set rstDA = Forms![D A]![DA Subform].FORM.RecordsetClone
 
M

Marshall Barton

You have not made it clear what you are really tring to
accomplish. Just filtering a form's data does not normally
involve using the form's recordset.

Check my earlier reply about it being safer to use
recordsetClone instead of Recordset.
--
Marsh
MVP [MS Access]

I left off the final .form prior to .Recordset.
So I think I've got it working.

JamesDeckert said:
Access 2003

I would like to use the recordset of a subform from a different form.
Both forms will be loaded.
I will be using the recordset as Read Only (no changes to the records of the
first form)

This is what I'd like to do
Dim rstDA As DAO.Recordset
If CurrentProject.AllForms.Item("D A").IsLoaded Then
Set rstDA = Forms![D A]![DA Subform].Recordset
End If

However the subform doesn't have a Recordset property
I'm looking at one of the fields in the DA form to filter the second form.
 
G

Guest

Marsh,
Thanks for the input. Sorry for the slow response.

The reason was that the first form could be filtered and sorted in a variety
of ways and the second form is a detail form that gives other details not
included on the first form. I tried the recordsetclone like you suggested,
but when using recordset the cursor on the first form moves along with the
navigation of the records on the second form. I like this because the user
can keep an eye on where they are at in the grand scheme of things and what
is coming up. Recordsetclone doesn't move the cursor on the first form, so
I'll probably stick with recordset unless there is some other reason to use
it.

thanks again,
James

Marshall Barton said:
JamesDeckert said:
Access 2003

I would like to use the recordset of a subform from a different form.
Both forms will be loaded.
I will be using the recordset as Read Only (no changes to the records of the
first form)

This is what I'd like to do
Dim rstDA As DAO.Recordset
If CurrentProject.AllForms.Item("D A").IsLoaded Then
Set rstDA = Forms![D A]![DA Subform].Recordset
End If

However the subform doesn't have a Recordset property


The subform CONTROL is the container for the form object
being displayed as a subform so it can only be used as a
stepping stone on your way to the (sub)form's properties.

If you do not want to affect the form's current record, then
you should use the RecordsetClone instead of Recordset:

Set rstDA = Forms![D A]![DA Subform].FORM.RecordsetClone
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top