Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    6

    Exclamation Unanswered: Delete AUTONUMBER in ACCESS using ASP

    ***ASP & ACCESS***

    So i eventually got it right inserting data into a table that holds an autonumber field....

    The problem I'm facing now is to delete one of those records.
    For some reason it just isn't as simple as deleting a record where there isn't an autonumber involved...

    I basically have:
    sql1 = "DELETE * FROM table WHERE userID = '" & tempID & "' "

    THIS STATEMENT USED TO WORK WHEN THE ID FIELD WAS SET AS TEXT.
    So my guess is that something else has to change.

    Anybody out there that can shine some light on my problem?



    Thanks in advance!

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    try this...

    sql1 = "DELETE * FROM table WHERE userID = " & tempID & " "

    your id field is now a number, not text. Removing the single quote will allow the statement to work...

    In theory comparing a numeric value to a string value should never find a match because they are nothing like each other, it would be like comparing the clock speed of a computer with the clock speed of a coconut.

  3. #3
    Join Date
    Feb 2004
    Location
    South Africa
    Posts
    6

    Cool Thanks

    Thank you for your reply

    I made the changes and it works!
    Now i also know why.

    THANK YOU ONCE AGAIN!

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    It works on the same theory as comparing NULL.

    You should never use

    if XYZ = Null then

    because if something is null it means you have no idea what it is,.. it is completely undefined.... you don't know that it doesn't = XYZ because you can't compare the two together....

    Anyway, glad to be of service.

  5. #5
    Join Date
    Apr 2003
    Location
    Evansville, Indiana
    Posts
    76
    Originally posted by rokslide
    ...it would be like comparing the clock speed of a computer with the clock speed of a coconut.
    Hmmm...what would the clock speed of a coconut be if it were carried by an African swallow? heh-heh

    Kael

Posting Permissions

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