property item is readonly problem

Posted on 2007-10-10
Last Modified: 2013-11-26
Hey guy i have only just started using and having a issue with connecting to a access mdb database

it looks like it connects ok but i am getting a "property item is readonly" when u try to access any of the records

        Dim rs As New ADODB.Recordset
        Dim sql As String
        Dim count As Integer

        sql = "select * from [pointers]"
        rs.Open(sql, cnn1, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockPessimistic)

        rs.Fields("stockid") = stockn.Text + 1

and this is the connection i am using

Option Explicit On
Module Module1

    Public DBFile As String
    Public Source As String
    Public cnn1 As New ADODB.Connection
    Public ShowExt As Boolean
    Private HasAccess As Boolean

    Public Sub connect()

        Dim rs As New ADODB.Recordset
        Dim sql As String

        DBFile = Application.ExecutablePath()
        If Right(DBFile, 1) <> "\" Then
            DBFile = DBFile & "\"
        End If
        DBFile = "posit.mdb"
        cnn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & DBFile & ";jet oledb"


        Exit Sub
        MsgBox(Err.Description & vbCrLf & vbCrLf & "Failed to 'connect to database", vbCritical, "Error")
        Resume DBSafe
    End Sub
End Module
Question by:awolarczuk
    LVL 46

    Accepted Solution


    You'll probably need to specify the correct property....

        rs.Fields("stockid").Value = stockn.Text + 1

    Also, since the advent of .Net, ADODB has been replaced by ADO.NET. See here for an overview of ADO.NET ->


    LVL 27

    Expert Comment

    HI awolarczuk,

    Here is a sample that has helped others.
    I would not use recordsets, move to datasets (almost the samething)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Suggested Solutions

    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now