Results 1 to 2 of 2

Thread: Updating Access database

  1. #1
    Ken Guest

    Updating Access database

    Hi, I have a problem that hopefully someone can help me with. I am trying to use a form to update an MS Access database. Below is the VBScript code I am using:

    conn.Execute "update Userlist set City = '"&Cty&"' where ID = '"&H1&"'"

    The ID column in the table (Userlist) is autogenerated by Access and is the primary key. I get the following error:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
    [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    /MCM2000Tracking/edit_database.asp, line 190

    It works fine if I don't use ID and instead use some other column in the table. For example (where Country = '"&Ctry&"&#39 works. Can someone please tell me why using the ID column doesn't work? Does it have something to do with the fact that the numbers in that column are autogenerated by Access? How can I change the syntax of my script or the settings in the Access table itself to resolve the "Data type mismatch" error? Another wierd thing is that line 190 doesn't exist. There are only about 150 lines in my program. What's up with that?

    Thanks in advance,
    Ken


  2. #2
    paul Guest

    Updating Access database (reply)

    The ID Code is a number(integer) so you should NOT enclose it in quotes (&#39 as this pertains to string datatypes.


    ------------
    Ken at 8/4/00 11:40:25 AM

    Hi, I have a problem that hopefully someone can help me with. I am trying to use a form to update an MS Access database. Below is the VBScript code I am using:

    conn.Execute "update Userlist set City = '"&Cty&"' where ID = '"&H1&"'"

    The ID column in the table (Userlist) is autogenerated by Access and is the primary key. I get the following error:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
    [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
    /MCM2000Tracking/edit_database.asp, line 190

    It works fine if I don't use ID and instead use some other column in the table. For example (where Country = '"&Ctry&"&#39 works. Can someone please tell me why using the ID column doesn't work? Does it have something to do with the fact that the numbers in that column are autogenerated by Access? How can I change the syntax of my script or the settings in the Access table itself to resolve the "Data type mismatch" error? Another wierd thing is that line 190 doesn't exist. There are only about 150 lines in my program. What's up with that?

    Thanks in advance,
    Ken


Posting Permissions

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