No data so subform is blank - what (and how) to do?

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

Guest

I have a 1-many form subform in a Access 2002 .ADP. As I transverse records
in the form, when there are no records that pertain to the subform, the
subform is rather blank. I think I need to add a blank record to the many
side of the relationship to allow the subform to display, then open the
subform with DoCmd. Is that correct? What is the best way to do that?
 
You are right that the form is blank because there are no records but it
also means that either the recordset the subform is attached to isnt
updatable in that you cant add records or that the subform hass the
addrecords (allowadditions) turned off. If the subform is only displaying
data from one table then you should revist the query & linking for the
subform to make it updatable. With adp you also have to set the updatable
table in the form properties. If this is not realistic then you could add a
trigger in the server so that when a new record is created on the 1 side the
server adds blanks to the many side. Alternatively you could add code to the
adp to either do this when you create the 1 side record or when the sub form
finds no records. With an adp the primary id field will be null while with
an mdb/jet you will find that the primary id field if it has been set to
autonumber is not null. Providing you are solely using adp it is feasible to
do it the later way but of all 3 the trigger method is the most efficient.
Better still would be to get the subform set up properly.

rgds
stephen
 
Thanks - that was very helpful.

The subform as alternated between displaying and not for no reason that I
can discern. It was working fine, allowing me to add records to the 'many'
side, until I added a second subform to the same page/tab. Then the first
reverted to not displaying when there is no data on the many side, as the
second (new) subform does. What exact conditions are necessary to make the
subform allow additions? I don't think I changed anything you mentionded and
now the original subform has reverted to no display with no records. The
properties are set to allow additions in both. Both recordsets are
updateable snapshots. Its a mystery.

At an earlier point, with the original subform I had a Add Record buttton
that would appear, and would allow the user to add a record when there was
none. Do I have to revert to that?

Nick
 
Back
Top