Form-Subform Programming

  • Thread starter Thread starter John S
  • Start date Start date
J

John S

Hi,

I want to program a form and subform combinatinon to function with a "save"
button, and have done some VBA (and VB) programming. Can anyone suggest a
good reference on the web to the programming of subform controls ?

J. Smith
Aylmer, PQ
 
This is not going to work for a bound form and subform, if you expect to
enter records and then save the main form and subform records together.
 
Oh, I agree -- Have to move to unbound form / subform arrangement. The
application is for pet licensing: the form is owner information, and the
subform is a datasheet with data on each pet. Currently it is a bound form,
and as you said, it doesn't and can't support a save button.

The current system works fine, but there are some limitations on validation
and we'd like to get a bit more control over the process. I'm comfortable
accessing and updating the database directly (docmd.runSQL, etc), I'm
somewhat unsure how to update the subform datasheet, or take values from
it.

John S.
 
Either bind the subform to an temporary table, and then commit to the real
table with an INSERT/DELETE query pair.

Or, provide a fixed number of controls that behave like a limited
(unscrolling) datasheet.
 
Thanks for the advice; you seem to be suggesting that one cannot directly
populate a datasheet, but have to operate through the bound temporary table.

I would have thought there was some way to directly populate a datasheet;
some available property and means of referencing individuals fields within
the datasheet. From my search thus far, there doesn't appear to be.

BTW, great web site.

John S
Aylmer, Quebec (Canada)
 
No, a datasheet on an unbound form will consist of one row only.

In Access 2000 and later, it is possible to create a recordset and point the
form's Recordset property at the recordset in memory. Haven't tried to do
that for the purposes of a temp recordset as it does not seem much different
conceptually from a temp table, though perhaps a bit less stable.
 
Thanks agauin for a very insightful discussion. I'll probably go the
temporary table route; it should be stable enough and will get me my save
button!.

Thanks again.

John S.
Aylmer, PQ
 
Back
Top