new "cannot add" error situation

R

rbchildrn

"You cannot add or change a record because a related record is required
in "tblOrganizations"

I am getting this error and the setup is correct based on other posted
solutions (child/master, record exists in main form before entering in
subform, etc.).

I think I may have set up some "illegal" relationships. I get this
error from one combo box on a subform. Here's the funky setup:

The Main Form is based on a table with general info about
volunteers/donors (tblPeople). There are two subforms, one based on
tblDonorContribs where you enter donation information, and one based on
tblEventParticipation where you enter volunteering information. The
EventParticipation form is giving me the trouble; DonorContribs works
fine.

When I select a "location" on the EventParticipation form, I get the
error. I think this is because the location is selected from a combo
box based on a query that pulls data from another table,
tblOrgLocations. TblOrgLocations is the many side of a relationship
with TblOrganizations, which is referred to in the error. I think
something about this convoluded maze of relationships is not allowed,
but I don't know the rules or how to better arrange it.

We have it set up this way so that we can track various locations under
the same organization, and only some types of locations show up in the
combo box "Locations," since not all locations can accept volunteers.
TblOrgLocations separates these locations using a "Location Type"
field. But since the "Locations" combo box is populated by information
from TblOrgLocations that I know corresponds to an existing record in
TblOrganizations, I don't understand how I can get the "related record
is required" error.

I can give you much more specific information, but I hope I've given
enough here for someone to know what question to ask next...

Thanks!
 
R

rbchildrn

Wow, I fixed it immediately after I posted. Sloppy table creation -
Access put a default value of 0 automatically in TblEventPartication
under the OrgID field when I created it. Since that was the foreign
key from TblOrganizations, and there was no corresponding OrgID of 0,
it gave the error. I removed the default value and everything works
now. Thanks for reading, I hope maybe this helps someone else!
 

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