Can't add records in form

D

DA

I'm stuck! I created this fantastic form with 2 subforms
but now I can't enter any data.
The main form is based on a Company table and it gets the
CompanyName from there.
The first subform is based on a query that links
Company.CompanyName with AgreementHistory.CompanyName and
then the second sunform also based on the query is linked
to the first subform by AgreementID autonumber. Now I
can't add any records to the subforms. Error is "cannot
add records(s); join key of table tblAgreementHistory not
in recordset". My subform were originally based directly
on the table but I couldn't sort on one of the fields so I
changed it to a query. Help!
 
J

John Vinson

I'm stuck! I created this fantastic form with 2 subforms
but now I can't enter any data.
The main form is based on a Company table and it gets the
CompanyName from there.
The first subform is based on a query that links
Company.CompanyName with AgreementHistory.CompanyName and
then the second sunform also based on the query is linked
to the first subform by AgreementID autonumber. Now I
can't add any records to the subforms. Error is "cannot
add records(s); join key of table tblAgreementHistory not
in recordset". My subform were originally based directly
on the table but I couldn't sort on one of the fields so I
changed it to a query. Help!

Two suggestions:

- Base the Subforms, not on a query joining the mainform's table to
the related table, but just to the related table. It is not necessary
- and in fact can cause problems - to have the main table represented
twice, once on the form and once in the subform.

- If you DO use the query, open the query in design view and make sure
that BOTH Company.CompanyName *and also* AgreementHistory.CompanyName
are selected into the query grid; do the same with AgreementID -
include both instances.
 

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