Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008

    Unanswered: Help on ADO .edit record set

    Hi, I am having a really hard time with my SQL Server db and MS SQL 2002. I am getting an error saying "Another user is updating the same record as you." There is nobody else using the db since I am developing it and I am not sure why this is happening. The project is in trouble because we need to send this out to UAT next week. I have attached a copy of some of the code below and any help would be greatly appreciated.

    Dim rs As New ADODB.Recordset

    If PubActHistPend = "P" Then

    sql = "SELECT * FROM " & sTable & " WHERE " & sTableID & " = " & nCurRec

    Set rs = OpenADORecordSet(sql)

    If rs.RecordCount > 0 Then
    rs!Status = "H"
    rs!ChgCode = "X"
    rs!ApproverName = PubUser
    rs!ApproverTime = Date & " " & Time()
    Inactivate = True
    'SetRecSource ("P")
    MsgBox "There was an error trying to delete record. Please contact programmer."
    Exit Function
    End If
    'Me.RecordSource = "SELECT * from Holiday where Status = 'P'"
    Exit Function
    End If



    This is the OpenADORecordSet code

    Public Function OpenADORecordSet(ByVal Source As String) As ADODB.Recordset

    On Error GoTo OpenRecordsetError

    Set OpenADORecordSet = New ADODB.Recordset

    OpenADORecordSet.Open Source, CurrentProject.Connection, adOpenDynamic, , adCmdText


    Exit Function


    Debug.Print "Database_.OpenRecordset : Error : " & Err.Description
    Err.Raise Err.Number, Err.Source, Err.Description


    Does anybody know why this is happening? Is this not the way to edit a record in ADO? Should I be using set rs = nothing as well?

    End Function

  2. #2
    Join Date
    Apr 2004
    metro Detroit
    Not sure if this is the problem:

    sql = "SELECT * FROM " & sTable & " WHERE " & sTableID & " = " & nCurRec

    is missing the ending quote.

Posting Permissions

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