Two Field Integrity

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Elias Farah

    #1

    Two Field Integrity

    G'day All,

    I am working on something, and wonder if I am approaching it
    correctly....

    3 Tables......... ..

    ProductTable
    ProductID - PK

    StockLocationTa ble
    StockLocationID - PK

    StockTakeLineTa ble
    StockTakeLineID - PK
    StockTakeID - FK
    ProductID - FK
    StockLocationID - FK


    What is the best way to enforce that in the StockTake Table, their is
    no identical records with the same (ProductID & Stocklocation) -
    giving effectively a duplicate input record.

    Currently, I am trying to test while inputing into the subform, but it
    does get difficult to know you are covering all bases.

    Now and then, I check and find the same record has been inadertently
    typed in. I think it may have been some whacker pressing the page
    down key accidently on the form, which is fixed now. But perhaps
    there is other holes?


    Thanks in advance to any contributors!

    Elias Farah.
  • Rick Brandt

    #2
    Re: Two Field Integrity

    "Elias Farah" <longnose@hotma il.com> wrote in message
    news:c6cfe5a6.0 309210413.67881 cb2@posting.goo gle.com...[color=blue]
    > G'day All,
    >
    > I am working on something, and wonder if I am approaching it
    > correctly....
    >
    > 3 Tables......... ..
    >
    > ProductTable
    > ProductID - PK
    >
    > StockLocationTa ble
    > StockLocationID - PK
    >
    > StockTakeLineTa ble
    > StockTakeLineID - PK
    > StockTakeID - FK
    > ProductID - FK
    > StockLocationID - FK
    >
    >
    > What is the best way to enforce that in the StockTake Table, their is
    > no identical records with the same (ProductID & Stocklocation) -
    > giving effectively a duplicate input record.
    >
    > Currently, I am trying to test while inputing into the subform, but it
    > does get difficult to know you are covering all bases.
    >
    > Now and then, I check and find the same record has been inadertently
    > typed in. I think it may have been some whacker pressing the page
    > down key accidently on the form, which is fixed now. But perhaps
    > there is other holes?[/color]

    You can create a unique index consisting of those two fields and then the
    database engine will enforce the rule.


    Comment

    Working...