Results 1 to 2 of 2

Thread: AddNew Problem

  1. #1
    Join Date
    Jan 2005
    Posts
    1

    Question Unanswered: AddNew Problem

    Im wondering if anyone can suggest a solution to my problem. Im simply trying to connect to a database through VB 6 and add a new record and populate one of the fields.
    Any help would be great.


    The code below throws up error message 'Current Recordset does not support updating. This may be a limitation of the provider or of the selected locktype'


    Dim adoConnection As ADODB.Connection
    Dim adoRecordset As ADODB.Recordset
    Dim connectString As String
    Dim RecordSQL As String

    RecordSQL = "SELECT * From Programme"

    Set adoConnection = New ADODB.Connection
    Set adoRecordset = New ADODB.Recordset

    connectString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=C:\MyDatabase.mdb"
    adoConnection.Open connectString
    adoRecordset.Open RecordSQL, adoConnection

    adoRecordset.AddNew
    adoRecordset!UserName = txtProgrammeNumber.Text
    adoRecordset.Update

    adoRecordset.Close
    adoConnection.Close
    Set adoRecordset = Nothing
    Set adoConnection = Nothing

  2. #2
    Join Date
    Dec 2004
    Location
    Laguna, Philippines
    Posts
    147
    instead of this...
    adoRecordset.Open RecordSQL, adoConnection

    try this...
    adoRecordset.Open RecordSQL, adoConnection, , adLockPessimistic
    Give me a place to code and i shall move the earth!

Posting Permissions

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