Results 1 to 3 of 3
  1. #1
    Join Date
    May 2012

    Unanswered: Homework Assistance, Please

    Hi Guys,

    Basically for an assignment piece i need to use a validation rule for something... well atleast i am sure that its a validation rule.

    What i need to do:

    I have a suppliers field in my database and so what i need to do is that when a new supplier is being entered and it happens to already exists then i need something to tell me how it can do that..


  2. #2
    Join Date
    Mar 2009
    Provided Answers: 14
    1. Determine a field or a set of fields that can uniquely identify a supplier. An obvious candidate is the VAT number, if such a thing exist in your country, because:
    a) Two suppliers (individual people or firms) cannot have the same VAT Number: this number uniquely identify each of them.
    b) Any individual or firm involved in commercial transactions must have a VAT number.
    c) It's not supposed to change (at least not often).
    Otherwise, it can be any combination of fields that can uniquely identify a supplier, e.g. FirstName, LastName, Address: it is very unlikely that 2 different suppliers would share the same first and last names as well as the same address.

    2. Create an index on the column or columns you have determined in 1. here above. Set the NOT NULL and UNIQUE attributes for this index. This means that:
    a) You cannot have the same value(s) more than once in the indexed field(s).
    b) You must supply a value for those field(s).

    Note: You could be tempted to create the primary key for the table from this (or these) field(s). Be aware that a primary key is not supposed to be changed, ever (changing a primary key can be a complex and risky process). Even "fixed" or "permanent" data happens to change over time. A few years ago, the VAT numbering system changed in the country where I live, and I know several cases where the obligation of bulk modifying the VAT numbers in commercial databases turned to a nightmare, precisely because the VAT number was used as a primary key.
    Have a nice day!

  3. #3
    Join Date
    May 2012

    Thanks for the reply..

    The thing with this is that my database is fairly basic and does not include things like VAT..

    Ill give another example:

    I have microsoft as a supplier and so what i want to do now i make it so that when a new supplier is being entered, and microsoft is entered again, i want it so that a prompt comes up and says that it already exists.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts