Add form with subform not working

A

AltaEgo

Hi all,

Whilst I have been not using Access for five years, it has been even longer
since I created forms to enter data and I feel like I am back in the Access
newbie ranks.

After normalising someone else's statistics database, I am having problems
with a subform.

My memory was that to create an add form covering two tables, it is simply a
case of designing a subform linked to the 'many' side table and a form
linked to the 'one' side table. After creating the main form drag the sub
into place, check that Child and Master are linked correctly and that should
be it. Open the main form and add a record and the sub should automatically
update correctly as lines are entered. Since this is not happening for me, I
obviously have something wrong.

When I open my main form (which has its property set to data entry = yes).
It displays no record and allows entry of new data. However, if I have the
subform set as data entry = yes, the subform displays no lines at all; if I
have the subform data entry property = no, the subform displays records
relating to previous data. In other words, no matter how I set my subform
properties it does not display in the main form ready for new data.

Could it be that the main table ID field not being an autonumber is a
problem (I use Dsum to get a default value)?
Could it be that I need my main form bound to a query that links to the 2nd
table instead of a form?

Any help would be very much appreciated.
 
R

Rick Brandt

AltaEgo said:
My memory was that to create an add form covering two tables, it is
simply a case of designing a subform linked to the 'many' side table
and a form linked to the 'one' side table. After creating the main
form drag the sub into place, check that Child and Master are linked
correctly and that should be it.
Correct

Open the main form and add a record
and the sub should automatically update correctly as lines are
entered.

Also correct.
When I open my main form (which has its property set to data entry =
yes). It displays no record and allows entry of new data. However, if
I have the subform set as data entry = yes, the subform displays no
lines at all; if I have the subform data entry property = no, the
subform displays records relating to previous data.

What exactly do you have entered into the MasterLink and childLink
properties? That is really all that controls the subform's data behavior.
If you have those correct it should work for you.
Could it be that the main table ID field not being an autonumber is a
problem (I use Dsum to get a default value)?

There is no requirement about the DataType of the fields being related.
Could it be that I need my main form bound to a query that links to
the 2nd table instead of a form?

No. In fact doig so often is what makes forms with subforms behave
incorrectly. Each form should be bound only to its respective table or a
SELECT query that uses only that table.
 
A

AltaEgo

Rick Brandt said:
Also correct.


What exactly do you have entered into the MasterLink and childLink
properties? That is really all that controls the subform's data behavior.
If you have those correct it should work for you.


There is no requirement about the DataType of the fields being related.


No. In fact doig so often is what makes forms with subforms behave
incorrectly. Each form should be bound only to its respective table or a
SELECT query that uses only that table.
At least failing memory can't be blamed. Master and Child links were the
first place that received a visit and were checked repeatedly as the problem
failed to resolve (over about 4 hours!). I tried deleting and dropping the
fsub quite a few times with the same unexpected results. I guess the next
step will be to trash the current form and fsub and try building both again
using the form wizard this time. Can't wait to get back to work to attack it
again. The fresh air and pleasant sunshine are becoming too tolerable.
 
A

AltaEgo

AltaEgo said:
At least failing memory can't be blamed. Master and Child links were the
first place that received a visit and were checked repeatedly as the
problem failed to resolve (over about 4 hours!). I tried deleting and
dropping the fsub quite a few times with the same unexpected results. I
guess the next step will be to trash the current form and fsub and try
building both again using the form wizard this time. Can't wait to get
back to work to attack it again. The fresh air and pleasant sunshine are
becoming too tolerable.

I know feedback is a little tardy but better late ...

Both fsub and frm created again. Drag fsub into main form and no problem at
all. Now to find the peace needed to pull the rest together!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top