If I have a form where the RecordSource property is set to the name of a
table, then on opening the SingleForm form I can cycle through all the
records in the table one at a time via Next and Previous buttons on the
form.
However, I only want to cycle through a subset of the table. I have a
parent form which inputs selection criteria. With the selection criteria I
create a RecordSet (using ADO) in the parent form. The RecordSet object is
declared as Public, so it should be accessible in all modules.
I feel that when loading the main form from the parent form, I should be
able to set its RecordSource property to the Public RecordSet so that the
form sees only the selected subset of records. I do this through the Load
event.
But when I do this, I get an error message that the RecordSet is not
recognised as valid Record Source. The recordset remains open in the parent
form until the form is closed or another set of criteria is input.
What am I doing wrong? Is it not valid to have a recordset as the Record
Source in a form? Or am I not declaring the recordset object correctly such
that it is not recognised across modules? Is there a better way to achieve
this anyway?
--
Cheers,
Lyn.