Validating Primary Key Values

Results 1 to 2 of 2

Thread: Validating Primary Key Values

  1. #1
    Join Date
    Dec 1969

    Default Validating Primary Key Values

    I have a MS Access database and am allowing administrators to update one of the tables. I want to validate the form to ensure that the user cannot enter a primary key value that already exists in the database. <BR><BR>I have a recordset object taking the serial numbers (primary key) from the table in the database and am saying:<BR><BR>IF NOT RSSerial.EOF then<BR>%&#062;<BR> &#060;script type="text/javascript"&#062;<BR> {alert("The serial number already exists")<BR> }<BR> &#060;/script&#062;<BR>&#060;%<BR>Else<BR><BR>&#039;do the inserting here.<BR><BR>This is working fine but I am calling the same page in the form action and if the serial number entered is incorrect the user is informed and the page is refreshed and thus the user loses all of the information they have entered in the form. Is there any other way to do this? <BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Validating Primary Key Values

    When you try to insert a PK which already exist you get an error from the db. There&#039;s a FAQ on this on I think that&#039;s what you need.

Posting Permissions

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