Problem adding a new record to a subform

P

Paul

I'm running into a problem when I try to add certain records to a subform,
in that the following error messages appear:

1. You tried to assign the Null value to a variable that is not a variant
data type, and
2. The value in the field or record violates the validation rule for the
record or field.

The main form is based on a Projects table, and the subform is based on a
linking table between Projects (tblProject) and Contacts (tblContact). I
call the linking table tblProjectContact. The way you add a new Contact
record to the subform is by selecting a contact in a Combo Box. The error
messages only appear when I try to add a new Contact that has not yet been
assigned to a project.

But the thing that baffles me about this is that I actually have two
Projects forms, both of which have the Contact subform, and this problem
only occurs when I try to add new contacts to one of the Projects forms, but
not both of them.

The two Project forms and their Project-Contact subforms are based on the
same recordsets in the underlying queries, and the Master and Child linking
fields are both set to the same ProjectID field.

Can anyone give me an idea of why I'm running into this problem when I try
to add records to one subform but not the other?

Thanks in advance,

Paul
 
K

Ken Snell \(MVP\)

Sounds to me as if you've set the Required property for the foreign key
field (the one that links to the Project table) to Yes. Set that property to
No.
 

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