Form's Recordset property question

  • Thread starter Thread starter Craig Buchanan
  • Start date Start date
C

Craig Buchanan

How is using the form's Recordset property differ from using the RowSource
property? Does the RowSource generate a Recordset internally, then bind
that to the form?

If I want to use the Recordset property, can I use other Recordset types
other than a Dynaset? Will the Dynaset save changes when a record is
changed? Can it work w/ the form's new record functionality?

Thanks,

Craig
 
Craig,

The RowSource property (along with the RowSourceType property) is used to
tell Microsoft Access how to provide data to controls such as a list box, a
combo box, or an unbound OLE object such as a chart. Forms do not have a
RowSource property in Access.

When you refer to a form's Recordset property, I presume you mean
RecordSource property. The RecordSource property of a form can be a Table,
a saved/named query or a SQL (query) string.

When you set the form's Recordset property, you can also use the Recordset
Type property to:

Dynaset
Dynaset (inconsistent updates)
Snapshot

Dynasets allow you to write to the table (or updateable query) which is the
RecordSource of the form; Snapshots do not.

All of these terms are discussed at some length in VBA Help.
 
RowSource applies to combos and list boxes, so I will assume you are asking
about the form's RecordSource.

The form's RecordSource property is a string. You set it to the name of a
table, the name of a query, or a valid SQL statment. When you open the form,
Access loads the records. If you reassign a different string to the
RecordSource while the form is open, Access saves any edits that were in
progress, closes the records, and opens the new one. Performing a Requery
effectively does that too (but without changing the definition of what
records to get.)

The form's Recordset is completely different. This is a new property that is
nowhere near as useful, and quite dicey to work with. First, you need to
open a recordset in code, or get hold of one that is already open (such as
the Recordset of another open form). You then tell your form to use the same
recordset. You can see that it is now dependent on the existence of the
other Recordset, so you need to bear that in mind. The Form has its own
tranactions, so you also have to work though any concurrency issues and
ensure things are stable.

The Recordset technique is useful for only a *very* limited set of
scenarios, e.g. it is not useful for a subform where the
LinkMasterFields/LinkChildFields are constantly changing which records are
loaded in the subform.
 
Back
Top