Results 1 to 3 of 3
  1. #1
    Eunice.harris is offline Novice
    Windows 7 32bit Access 2000
    Join Date
    Mar 2012
    Posts
    5

    saving record in Access 2010 to nvarchar(max) causes type mismatch error 13

    I made two changes:
    1.saved my Access 2000 mdb file to Access 2010 accdb.
    2.changed the SQL Server Notes column of the tblContractNotes table, from ntext to nvarchar(max)

    using the same DAO code
    --I can save more than 8000 characters in Access 2000 using an ntext for the Notes column
    --but in Access 2010 with nvarchar(max) for the Notes column, I now can't save a record when the notes are over 4000 characters, get a "type mismatch" error 13 and an ODBC call failed error.

    code is:

    Public gdbTables As DAO.Database
    Set gdbTables = DBEngine(0)(0)


    Dim rst As DAO.Recordset
    Dim rstContracts As DAO.Recordset
    Dim str As String


    Dim strNotes As String
    Dim dteDTS As Date
    Dim tmpItem As Variant

    strNotes = "" 'in other cases stuff is added, but not in this case that I tried
    Set rst = gdbTables.OpenRecordset("SELECT * FROM tblContractNotes WHERE 1 = 2", dbOpenDynaset, dbSeeChanges)
    With rst
    .AddNew
    !ContractID = mlngContractID
    !SCView = Me.chkSCView
    !Urgent = Me.chkUrgent
    !UserID = glngUserID
    !Notes = strNotes & Me.txtNotes 'tried more than 4000 characters
    .Update
    End With


    In Access 2000, I use DAO 3.6.

    I noticed in Access 2010, I didn't change any Tools/References, but it doesn't show any DAO, but maybe it's included somewhere. I used the default Tools References, which were:
    -Visual Basic For Applications
    -Microsoft Access 14.0 Object Library
    -OLE Automation
    -Microsoft ActiveX Data Objects 2.1 Library
    -Microsoft Office Web Components 9.0
    -Microsoft Office 14.0 Access database engine Object Library
    -Microsoft Visual Basic for Applications Extensibility 5.3

    Thanks for any suggestions.

  2. #2
    PRMiller is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2012
    Location
    St. Paul, MN
    Posts
    16
    What version of SQL Server are you using? There appears to have been a data conversion issue with SQL Server 2000. See: http://www.tech-archive.net/Archive/.../msg00040.html

    As far as DAO is concerned, you've got a reference to the Microsoft Access 14.0 Object Library, which is the standard DAO reference for Access 2010.

  3. #3
    Eunice.harris is offline Novice
    Windows 7 32bit Access 2000
    Join Date
    Mar 2012
    Posts
    5
    It is SQL Server 2008 R2

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run-time error '13': Type mismatch
    By uronmapu in forum Access
    Replies: 2
    Last Post: 07-10-2012, 07:59 PM
  2. Type mismatch Error after upgrading to Access 2010
    By twm07073 in forum Programming
    Replies: 7
    Last Post: 06-13-2012, 10:07 AM
  3. Replies: 1
    Last Post: 05-11-2012, 10:59 AM
  4. Error#13 Type Mismatch
    By Nistin27 in forum Access
    Replies: 8
    Last Post: 08-17-2011, 04:15 PM
  5. type mismatch error?
    By hlcarlin in forum Programming
    Replies: 1
    Last Post: 07-07-2011, 08:30 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums