80020005 problem with Access field Types (text vs. number)

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default 80020005 problem with Access field Types (text vs. number)

    I'm baffled...

    I'm just trying to update data in an access db. All works well when I
    have text and memo fileds only. When I change one of the fileds to
    number, it bombs with

    80020005

    Data Type mismatch

    The 'stockStatus' filed is the one in question. Here's my code...

    'UPDATE PRODUCT DATA
    CODE-------------------------------------------------------
    if request.form ("table") = "data" then
    MySQL = "SELECT * FROM products WHERE ID="&request.form("intID")&""
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.CursorType = 2
    rs.LockType = 3
    rs.Open MySQL, MyConn

    rs.fields("productName") = request.form("productName")
    rs.fields("productPhrase") = request.form("productPhrase")
    rs.fields("productInfo") = request.form("productInfo")
    rs.fields("productDesc") = request.form("productDesc")
    rs.fields("productPrice") = request.form("productPrice")
    rs.fields("productPrice6") = request.form("productPrice6")
    rs.fields("productPhraseSpecial") =
    request.form("productPhraseSpecial")
    rs.fields("productPotency") = request.form("productPotency")
    rs.fields("productCount") = request.form("productCount")
    rs.fields("productFamily") = request.form("productFamily")
    rs.fields("productServingSize") = request.form("productServingSize")
    rs.fields("productServingsPerBottle") =
    request.form("productServingsPerBottle")
    rs.fields("productSavings") = request.form("productSavings")
    rs.fields("bottleType") = request.form("bottleType")
    rs.fields("stockStatus") = request.form("stockStatus")
    rs.fields("listStatus") = request.form("listStatus")
    rs.fields("listName") = request.form("listName")
    rs.fields("conditionID") = request.form("conditionID")
    rs.fields("specialStatus") = cstr(request.form("specialStatus"))
    rs.fields("synaroCode") = request.form("synaroCode")
    rs.fields("bonusText") = request.form("bonusText")
    rs.fields("productThumb") = request.form("productThumb")
    rs.fields("productImage") = request.form("productImage")
    rs.fields("genderID") = request.form("genderID")
    rs.fields("orderW") = request.form("orderW")
    rs.fields("orderM") = request.form("orderM")
    rs.fields("orderS") = request.form("orderS")

    rs.Update
    rs.Close
    Set rs = Nothing
    MyConn.close
    set MyConn = nothing
    response.Redirect "addData.asp?ID=" & request.form("intID")
    end if


    Please Help oh Wise coders!

    Thanks
    Joe Guest

  2. Similar Questions and Discussions

    1. Identify credit card types based on thier number
      As a practice and learn session, I'd like to construct a FileMaker calc field that "looks" at a credit card number in a field, and then ID the card...
    2. Last number in the array --- access problem --Newbie question
      Here is the complete problem: I have two files MAER_FILE and EVAL_FILE MAER_FILE contains ITR Max_error Avg_error Min_error...
    3. finding a characters number in a text field
      charPosToLoc uses a number to define which character in the text field you are querying. I want to know what number char of line is in a text...
    4. Increment a number in a text field
      I'm having problems getting a text field to automatically increment, exp. when you add a record to a form, it should automatically give a new id...
    5. Access Text Field Max Size
      Hi all, I'm using an Access db as the backend for a little app (I know, I know.) I just ran into a problem where the user needs to submit a string...
  3. #2

    Default Re: 80020005 problem with Access field Types (text vs. number)

    Have you considered using an update statement or a stored query, instead of
    a recordset? recordsets are for *retrieving* data.
    [url]http://www.aspfaq.com/2191[/url]

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Joe" <joew@vca.com> wrote in message
    news:1448d55e.0407260529.5502ae3d@posting.google.c om...
    > I'm baffled...
    >
    > I'm just trying to update data in an access db. All works well when I
    > have text and memo fileds only. When I change one of the fileds to
    > number, it bombs with
    >
    > 80020005
    >
    > Data Type mismatch
    >
    > The 'stockStatus' filed is the one in question. Here's my code...
    >
    > 'UPDATE PRODUCT DATA
    > CODE-------------------------------------------------------
    > if request.form ("table") = "data" then
    > MySQL = "SELECT * FROM products WHERE ID="&request.form("intID")&""
    > Set rs = Server.CreateObject("ADODB.Recordset")
    > rs.CursorType = 2
    > rs.LockType = 3
    > rs.Open MySQL, MyConn
    >
    > rs.fields("productName") = request.form("productName")
    > rs.fields("productPhrase") = request.form("productPhrase")
    > rs.fields("productInfo") = request.form("productInfo")
    > rs.fields("productDesc") = request.form("productDesc")
    > rs.fields("productPrice") = request.form("productPrice")
    > rs.fields("productPrice6") = request.form("productPrice6")
    > rs.fields("productPhraseSpecial") =
    > request.form("productPhraseSpecial")
    > rs.fields("productPotency") = request.form("productPotency")
    > rs.fields("productCount") = request.form("productCount")
    > rs.fields("productFamily") = request.form("productFamily")
    > rs.fields("productServingSize") = request.form("productServingSize")
    > rs.fields("productServingsPerBottle") =
    > request.form("productServingsPerBottle")
    > rs.fields("productSavings") = request.form("productSavings")
    > rs.fields("bottleType") = request.form("bottleType")
    > rs.fields("stockStatus") = request.form("stockStatus")
    > rs.fields("listStatus") = request.form("listStatus")
    > rs.fields("listName") = request.form("listName")
    > rs.fields("conditionID") = request.form("conditionID")
    > rs.fields("specialStatus") = cstr(request.form("specialStatus"))
    > rs.fields("synaroCode") = request.form("synaroCode")
    > rs.fields("bonusText") = request.form("bonusText")
    > rs.fields("productThumb") = request.form("productThumb")
    > rs.fields("productImage") = request.form("productImage")
    > rs.fields("genderID") = request.form("genderID")
    > rs.fields("orderW") = request.form("orderW")
    > rs.fields("orderM") = request.form("orderM")
    > rs.fields("orderS") = request.form("orderS")
    >
    > rs.Update
    > rs.Close
    > Set rs = Nothing
    > MyConn.close
    > set MyConn = nothing
    > response.Redirect "addData.asp?ID=" & request.form("intID")
    > end if
    >
    >
    > Please Help oh Wise coders!
    >
    > Thanks

    Aaron [SQL Server MVP] Guest

  4. #3

    Default Re: 80020005 problem with Access field Types (text vs. number)

    "Joe" <joew@vca.com> wrote in message
    news:1448d55e.0407260529.5502ae3d@posting.google.c om...
    > I'm baffled...
    >
    > I'm just trying to update data in an access db. All works well when I
    > have text and memo fileds only. When I change one of the fileds to
    > number, it bombs with
    >
    > 80020005
    >
    > Data Type mismatch
    >
    > The 'stockStatus' filed is the one in question. Here's my code...
    >
    > 'UPDATE PRODUCT DATA
    > CODE-------------------------------------------------------
    > if request.form ("table") = "data" then
    > MySQL = "SELECT * FROM products WHERE ID="&request.form("intID")&""
    > Set rs = Server.CreateObject("ADODB.Recordset")
    > rs.CursorType = 2
    > rs.LockType = 3
    > rs.Open MySQL, MyConn
    >
    > rs.fields("productName") = request.form("productName")
    > rs.fields("productPhrase") = request.form("productPhrase")
    > rs.fields("productInfo") = request.form("productInfo")
    > rs.fields("productDesc") = request.form("productDesc")
    > rs.fields("productPrice") = request.form("productPrice")
    > rs.fields("productPrice6") = request.form("productPrice6")
    > rs.fields("productPhraseSpecial") =
    > request.form("productPhraseSpecial")
    > rs.fields("productPotency") = request.form("productPotency")
    > rs.fields("productCount") = request.form("productCount")
    > rs.fields("productFamily") = request.form("productFamily")
    > rs.fields("productServingSize") = request.form("productServingSize")
    > rs.fields("productServingsPerBottle") =
    > request.form("productServingsPerBottle")
    > rs.fields("productSavings") = request.form("productSavings")
    > rs.fields("bottleType") = request.form("bottleType")
    > rs.fields("stockStatus") = request.form("stockStatus")
    > rs.fields("listStatus") = request.form("listStatus")
    > rs.fields("listName") = request.form("listName")
    > rs.fields("conditionID") = request.form("conditionID")
    > rs.fields("specialStatus") = cstr(request.form("specialStatus"))
    > rs.fields("synaroCode") = request.form("synaroCode")
    > rs.fields("bonusText") = request.form("bonusText")
    > rs.fields("productThumb") = request.form("productThumb")
    > rs.fields("productImage") = request.form("productImage")
    > rs.fields("genderID") = request.form("genderID")
    > rs.fields("orderW") = request.form("orderW")
    > rs.fields("orderM") = request.form("orderM")
    > rs.fields("orderS") = request.form("orderS")
    >
    > rs.Update
    > rs.Close
    > Set rs = Nothing
    > MyConn.close
    > set MyConn = nothing
    > response.Redirect "addData.asp?ID=" & request.form("intID")
    > end if
    >
    >
    > Please Help oh Wise coders!
    >
    > Thanks
    Try using CInt(), CDbl, or CLng(); as in:

    rs.fields("stockStatus") = CInt(request.form("stockStatus"))


    McKirahan Guest

  5. #4

    Default Re: 80020005 problem with Access field Types (text vs. number)

    I have wondered what those prefix's mean. Can you elaborate?

    Thanks

    > Try using CInt(), CDbl, or CLng(); as in:
    >
    > rs.fields("stockStatus") = CInt(request.form("stockStatus"))
    Joe Guest

  6. #5

    Default Re: 80020005 problem with Access field Types (text vs. number)

    Convert to int, convert to double, convert to long

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Joe" <joew@vca.com> wrote in message
    news:1448d55e.0407271119.39495b39@posting.google.c om...
    > I have wondered what those prefix's mean. Can you elaborate?
    >
    > Thanks
    >
    >
    > > Try using CInt(), CDbl, or CLng(); as in:
    > >
    > > rs.fields("stockStatus") = CInt(request.form("stockStatus"))

    Aaron [SQL Server MVP] Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139