Re: A philosophical newbie issue: catch redundant errors via relationships or programmically?

From: David Cressey <cressey73_at_verizon.net>
Date: Mon, 31 Dec 2007 15:59:43 GMT
Message-ID: <Pl8ej.785$nN5.267_at_trndny04>


"raylopez99" <raylopez99_at_yahoo.com> wrote in message news:dabe9ee9-bae3-4ce2-9b3f-9f76e963f596_at_p69g2000hsa.googlegroups.com...
> I'm a newbie to dB programming.

> However, I can't, under the below architecture, seem to do this via
> "relationships" in Access. I tried various combinations, but each
> time something went wrong. My most promising (I thought) attempt was
> to replace in the critical linking table "AccountStocks" below (please
> substitute "CD" for "stocks" below, because the architecture for CD
> and Stocks is exactly the same) with a new primary COMPOUND key
> comprising: StockSymbol (i.e. CD Symbol) and AcctID. However, this
> compound key creation did not give me what I wanted, in that the form
> I used did not allow me to create a new record twice having a
> different StockSymbol/CD ID but the same AcctID.

On a second reading of your initial post, I figured out that this is where things went wrong.

I don't think this is a problem with MS Access. I think it's a problem in the way you set things up.

If you set up a junction table correctly with a compound primary key consisting of CDSymbol and AcctId, you should be able to insert two rows with different CDIDs but the same AcctId. You should also be able to insert two rows with different AcctIDs but the same CDID, should that ever be necessary. But you won't be able to insert a new row with the same CDID and the same AcctID as a row that's already in there.

HTH. Received on Mon Dec 31 2007 - 16:59:43 CET

Original text of this message