ADO runtime error 3251

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ydprasad
    New Member
    • Sep 2006
    • 1

    ADO runtime error 3251

    I am trying to convert the code that was written in VB using DAO to ADO.
    But when i tried to do following getting an error '3251'.
    *************co de************* *************



    Dim cn As New ADODB.Connectio n
    cn.Open "Driver={Micros oft Access Driver (*.mdb)};Dbq=c: \Website Projects\ExitCa shFlow\logMaste r\Logs.mdb;"

    dim recdcath as adodb.recordset

    tstrSQL = "select * from ct_enccath where cteh_reg_no ='" & txtpat(0).Text & "'"
    Set recdcath = cn.Execute(tstr SQL)

    recdcath.Addnew

    *************** *************** *************


    Please let me know what I need to add to open this up in read/write. (It stops on the recdcath.Addnew and displays the error Runtime error '3251' Current Recordset does not support updating. This may be a limitation of the Provider, or of the select Locktype).
  • mra
    New Member
    • Sep 2006
    • 15

    #2
    Originally posted by ydprasad
    I am trying to convert the code that was written in VB using DAO to ADO.
    But when i tried to do following getting an error '3251'.
    *************co de************* *************
    please try the following code

    Dim cn As New ADODB.Connectio n
    cn.Open "Driver={Micros oft Access Driver (*.mdb)};Dbq=c: \Website Projects\ExitCa shFlow\logMaste r\Logs.mdb;"

    dim recdcath as adodb.recordset

    tstrSQL = "select * from ct_enccath where cteh_reg_no ='" & txtpat(0).Text & "'"
    set recdcath=cn.Exe cute(tstrSQL)
    recdcath.Addnew
    *************** *************** *************


    Please let me know what I need to add to open this up in read/write. (It stops on the recdcath.Addnew and displays the error Runtime error '3251' Current Recordset does not support updating. This may be a limitation of the Provider, or of the select Locktype).


    please try the following code

    Dim cn As New ADODB.Connectio n
    cn.Open "Driver={Micros oft Access Driver (*.mdb)};Dbq=c: \Website Projects\ExitCa shFlow\logMaste r\Logs.mdb;"

    dim recdcath as adodb.recordset

    tstrSQL = "select * from ct_enccath where cteh_reg_no ='" & txtpat(0).Text & "'"
    recdcath.open tstrSQL,cn,adOp enKeyset, adLockOptimisti c
    if recdcath.record count=0 then ' if necessary
    recdcath.Addnew

    endif

    Comment

    Working...