Allen ~ thanks for the quick reply. Responses and questions in-line
with your reply:
Allen said:
Tables look fine.
The message indicates that there is a field that is null when it cannot
be.
It is the innermost subform (bound that tblProjectBudgets) that has the
problem?
Open tblProjectBudgets in design view.
Remove any Default Value on any field.
Remove any Default Value from the controls on the form as well.
If the subform is bound to a query that includes other tables, open them
also and remove any Default Values.
Done. There was a default value, of "Now()", in the date field, but I
removed that.
Next, add a text box to the subform for the numBudget field. The
subform's
LinkMasterFields/LinkChildFields settings should cause this to populate
automatically, but you want to see that this is happening.
I added numBudget to sfrmProjectBudgetDetails and strIndex to
sfrmProjectBudget. strIndex is being populated in sfrmProjectBudget,
but numBudget is not in sfrmProjectBudgetDetails. I verified that
numBudget is set in the Master/Child fields for those subforms. I also
verified that the tables are related on that field.
Are you using a combo for strAccountCode? If so, check Bound Column and
RowSource of the combo. Right field being assigned?
Yes, the right field is assigned.
What is the primary key of tblProjectBudgets. Does this field have a
value
assigned?
Primary key of tblProjectBudget is foreign key of strIndex, linked as
combo box to [tblProjects]![strIndex]. Primary key of
tblProjectBudgetDetails is dual: foreign key of numBudget linked as
combo box to [tblProjectBudget]![numBudget], and strAccountCode (to
keep users from entering an account code more than once per budget).
Are there any other fields in the table that have their Required property
set to Yes?
No
Are there any other fields that are indexed "No Duplicates" in that
table?
No
I am now getting the "null value" error upon entering the first value
in sfrmProjectBudgetDetails. I can enter data in the fields, but
receive the error when tabbing to the next line (and thus attempting to
save the data). Interestingly, for projects with existing data in
sfrmProjectBudgetDetails, I can add records to sfrmProjectBudgetDetails
with no error (unless I try to add an account code already used on that
budget, so the primary key is working). Any thoughts?
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
message