Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003

    Question Unanswered: How to check if there is aleady a record??

    I wanna know the line of codes...

    I have a program that can be registered via handphone. But now the problem is, if the person's number is already in the database, I do want his/her record to be duplicated. Hmm, so may i know the line of codes please so that it won't be inserted again into the database if there is already his/her handphone number inside..

  2. #2
    Join Date
    Feb 2002
    San Francisco, CA
    I take the "handphone" means cellphone/mobile phone.

    You have two options;

    make the column which contains the cellphone number unique so the DBMS will not allow a duplicate record (hint: add a constraint),

    and or

    check before inserting the record into the table; e.g.
    rs.source="select count(*) as x from x where cellnumber=" & cdbl(cellnumber)
    if rs.fields("x")>0 then
     'there is already a record, this would be a dupe
     'insert the record it doesn't exist.
    end if
    set rs=nothing

Posting Permissions

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