Error creating new record in subform

R

Rich Schoenfeld

I have a subform within a main form. The link Master Field is a textbox on
the main form. The link Child Field is a CustomerID field in the underlying
table of the subform.

When I type in a customer ID into the textbox on the main form, the customer
information appears in the subform. Great!!

The problem:
I want to create a new customer. When I begin to enter customer info into
the subform, I get a message that reads...

"you tried to assign a null value to a variable that is not a variant data
type"

I believe the error has to do with the linking fields... What should I do?

Any help would be greatly appreciated.

Regards,
Rich
 
M

MacDermott

Assuming your main form is also bound to a table, you could try enforcing
referential integrity with a cascade update from the table behind the main
form to the table behind the subform.
Then always fill in the new Customer ID in the main form before adding data
in the subform.

HTH
- Turtle
 
R

Rich Schoenfeld

Actually, my main form is not bound to a table. I understand what you are
saying and I may do it that way. I did create a workaround. I removed the
link between the subform and the main form, and used the filter property.
This allowed it to work.

The only problem I have with your method is that if I click in the customer
information box, a customerID gets generated whether or not I start typing.

Thanks,
Rich
 

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