addnew/update is creating a duplicate record in ac

Results 1 to 2 of 2

Thread: addnew/update is creating a duplicate record in ac

  1. #1
    Join Date
    Dec 1969

    Default addnew/update is creating a duplicate record in ac

    Hi:<BR><BR>I&#039;m trying to grab form data and add it to a db. No problem--except that suddenly, I&#039;m getting duplicates of everything I add. The code for each of 3 tables looks like this:<BR><BR>sqlstmt1 = "select * from client"<BR>ClientRS.Open sqlstmt1, Conn, 1, 2<BR>ClientRS.AddNew<BR>ClientRS("ContactName") = Name<BR>ClientRS("BillTo") = Billme<BR>ClientRS("BillStreet") = BS<BR>ClientRS("City") = BC<BR>ClientRS("Province") = BP<BR>ClientRS("PC") = BillPC<BR>ClientRS("Phone") = BillPh<BR>ClientNum = ClientRS("ClientID")<BR>ClientRS.Update<BR><BR>I&# 039;ve been using this code for awhile, and only in the last little while have I noticed duplicates creeping in. Any ideas? I leave the RS&#039;s open until the end of the form, because I pull info from each as a foreign key in another.<BR><BR>Assistance greatly appreciated...<BR>UsH

  2. #2
    Join Date
    Dec 1969

    Default Bill's mantra: DEBUG DEBUG DEBUG

    Every place you have "AddNew", put in a Response.Write that tells you what you are adding. Ditto every place you have an "Update".<BR><BR>For a quick way to find the problem, change the database to make the "Phone" field *NOT* allow duplicates. That way, the second time a record is added with the same phone number, you will get an error.<BR><BR>(I&#039;m assuming that you wouldn&#039;t have the same phone number for more than one entry in the DB; certainly should be true if you include area codes and/or international prefixes.)<BR><BR>

Posting Permissions

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