check database

Results 1 to 2 of 2

Thread: check database

  1. #1
    Join Date
    Dec 1969

    Default check database

    how do i check to see if a record exsits before using the .addnew<BR>so if a record all ready exists,it&#039s not entered into the database

  2. #2
    Stephen Fisher Guest

    Default RE: check database

    1. Add the record anyways (I am assuming it gives a database error because of a primary key error) and trap for the error number.<BR>To write out the error use <BR>on Error resume next<BR>before the addnew and after it use<BR>response.write err.number<BR>Then whatever this error number is, you trap for it by using<BR>on error resume next<BR>rs.addnew<BR>if err.number = -21254325543(whatever) Then<BR> response.write "record already exists"<BR>end if<BR><BR><BR>2. Do a SQL statement using the criteria you have and then check for EOF. If at EOF then there is no record and you can safely call addnew.

Posting Permissions

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