Recordsets and forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can i reference the recordset underlying a nonactive form;i.e one that will not appear in the Forms collection. I have a dialog where the user will input search criteria. I want the on click event handler to then search one recordset underlying an already existing form, is the result Is Null, then I want to search the other recordset. I don't want to open any additional forms, UNLESS a match is found in that recordset ( then open the corresponding form with search result as current record.) Please help.
 
Use the same SQL or query that is the RecordSource of that Form -- in recent
versions of Access, you could refer to the Form in the AllForms collection
which includes both Open and unOpened Forms. The RecordSource is a string
value, as is the argument for the OpenRecordset method.

On the other hand, this may not be so common a function that you need to
make it so general -- it'll be simpler if you know and just code in the SQL
or saved Query name.

Larry Linson
Microsoft Access MVP

Svengali said:
How can i reference the recordset underlying a nonactive form;i.e one that
will not appear in the Forms collection. I have a dialog where the user will
input search criteria. I want the on click event handler to then search one
recordset underlying an already existing form, is the result Is Null, then I
want to search the other recordset. I don't want to open any additional
forms, UNLESS a match is found in that recordset ( then open the
corresponding form with search result as current record.) Please help.
 
All good, but what if the recordsource is a table and I wish to keep it as such? Also, how would I refer to the Form's recordset through the Allforms collection ( I have OFF XP ). I tried before but continually received a mssg notifying me that the method or property is not supported. I tried:

CurrentProject.Allforms!frmMasterFileDetails.Recordsetclon

----- Larry Linson wrote: ----

Use the same SQL or query that is the RecordSource of that Form -- in recen
versions of Access, you could refer to the Form in the AllForms collectio
which includes both Open and unOpened Forms. The RecordSource is a strin
value, as is the argument for the OpenRecordset method

On the other hand, this may not be so common a function that you need t
make it so general -- it'll be simpler if you know and just code in the SQ
or saved Query name

Larry Linso
Microsoft Access MV

Svengali said:
How can i reference the recordset underlying a nonactive form;i.e one tha
will not appear in the Forms collection. I have a dialog where the user wil
input search criteria. I want the on click event handler to then search on
recordset underlying an already existing form, is the result Is Null, then
want to search the other recordset. I don't want to open any additiona
forms, UNLESS a match is found in that recordset ( then open th
corresponding form with search result as current record.) Please help
 
Back
Top