Stumped on List Box Code - Null Values

C

Carrie

Thanks in advance for the help - I don't know what I'd do without this site!
I'm trying to create a number of multi-select list boxes that will feed all
the selections back into a table. I thought I was on the right track but now
I'm not so sure....

Detail_Types_TBL contains DetailTypeID (PK) and DetailTypes (of which there
are four: Direct Cause, Indirect Cause, Loss, Program Improvement)

Detail_Link_TBL: DetailLinkID (PK), DetailTypeID, Detail

I created 4 queries to select only one Detail Type each with the following
SQL:

SELECT Detail_Link_TBL.DetailLinkID, Detail_Link_TBL.DetailTypeID,
Detail_Link_TBL.Detail
FROM Detail_Link_TBL
WHERE (((Detail_Link_TBL.DetailTypeID)=1)); (or 2, 3 or 4)

I then created Near_Miss_Detail_TBL: NM_ID (PK), Near_Miss_ID (FK - to link
to the main table), DirectCauseID (FK - looks up Direct_Cause_QRY),
IndirectCauseID (FK - looks up Indirect_Cause_QRY), LossID (FK - looks up
Loss_QRY), ProgrImprovID (FK - looks up Progr_Improv_QRY)

I then built Near_Miss_Detail_Subform with the Record Source being the
Detail table and created a list box for each of DirectCauseID,
IndirectCauseID, LossID, ProgrImprovID and set the properties to MultiSelect
= Simple.

The subform does allow you to highlight multiple selections like I want but
when I save the record I get the error message "Index or primary key cannot
contain a Null Value"

In all the posts I read, I thought by creating the subform I would avoid
needing to write a lot of code (which I'm not that good at) but I'm not sure
if I misunderstood and do need to write some code? Any help would be
appreciated! Or have I messed up on the structure? If I built a seperate
table for each Detail Type and a seperate subform would that help?

Thanks Again
 

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