Allen,
Thanks for your post I think you are on the right track but I am not sure
what I am doing wrong. The Main form is a Family Record and the sub form
is
a set of dates that are associated with a child in the family. When I set
the Master and child link fields to the [FamilyId] I get this error when I
clear the [FamilyId] from these fields the error goes away but the sub
form
does not change records I assume due to them not being linked. [FamilId]
is
just a long int which is an auto number and the primary key in the Family
table [tblFamily]. The sub form is based on a query [qryHelper] that
includes the [FamilyId] from a table of student names joined with a table
of
dates associated with students.
[tblFamily]
FamilyId AutoNumber
Notes Memo
FamilyName Text
[qryHelper]
SELECT tblHelper.StudentId, tblHelper.NurseryDate, tblHelper.ProgramDate,
tblStudent.FamilyId, tblStudent.LastName, tblStudent.FirstName
FROM tblStudent INNER JOIN tblHelper ON tblStudent.StudentId =
tblHelper.StudentId
WHERE (((tblStudent.FamilyId)=[Forms]![frmFamilyEntry]![txtId]));
I am passing the [FamilyId] to the query by using a text field on the main
form.
Thanks for any help.
Thanks
Andrew
Allen Browne said:
Open the main form in design view.
Right-click the edge of the subform control, and choose Properties.
On the Data tab, what field is named in the LinkChildFields?
That field will inherit a value from the main form's field that is named
in
LinkMasterFields. If that value is not appropriate, you will receive the
Referential Integrity message.
For example, if the main form is at a new record and the field has zero
as a
default value, the zero will prevent the subform creating the new record.
If that is not the issue, post back with more information on the source
for
the main form (table or query?), the source for the subform (table or
query), and the names and data types of the fields named in
LinkMasterFields
and LinkChildFields.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Reply to group, rather than allenbrowne at mvps dot org.
I have a strange issue that I can not figure out. I have a sub form
that
if
I open the sub form alone I can add records to the form. When I try to
enter
records in the sub form as a part of the main form I get an error about
referential integrity. Any thoughts on where I should look for why
this
issue is happening.
Thanks
Andrew