Consulting

Results 1 to 5 of 5

Thread: Solved: can't update Memo field in Replica

  1. #1
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location

    Wink Solved: can't update Memo field in Replica

    I am working with a replicated databse. When I try to update the memo it fails throwing error 3188. Project is currently locked on this machine. I think it has something to do with the .ldb file that opens when you access the replica. Anyone know how to temporarily disable it with VBA then re-enable it when the update is complete? I know it kind of defeats the purpose of the ldb file... but some hacker out there is bound to know how to get around it... so why shouldn't I.

  2. #2
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    This was solved... I inserted

    [VBA]records.Fields("Memo").Value= strMemo[/VBA]
    between the records.Edit and the records.Update. No more problems..

  3. #3
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    Ok, for those who noticed my Emergency Synchronization post.... This is a result of that. When we synchronized the programs to update the forms and table designs. All the backend data and structure were updated. The front end was not though. I tried creating a replica of the design master and then basiclly all the buttons broke.

    The code is the same, but I am getting this error again. And what do you know it is in the same place. Any ideas?
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  4. #4
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    [VBA]
    Private Function BuildMemoField(ByVal PropertyID As String) As String
    On Error GoTo Err_buildMemoField
    Dim dbs As Database, qdf As QueryDef, strSQL As String
    Dim qry1, qry2 As Boolean
    Set dbs = CurrentDb
    strSQL = "SELECT PropertyID, PropertyNumber, NoteDate, entryType, RER, Contacts, Memo " & _
    "From tblPropertiesUpdates " & _
    "WHERE (((tblPropertiesUpdates.PropertyID) =" & PropertyID & ")) " & _
    "ORDER BY NoteDate DESC;"

    Set qdf = dbs.CreateQueryDef("qryUpdateMemo", strSQL)
    Dim strMemo As String
    Dim records As Recordset
    Set records = qdf.OpenRecordset
    Do Until records.EOF
    'FieldType (records.Fields("Memo").Type)
    strMemo = strMemo & CStr(records.Fields("NoteDate").Value) & ": "
    strMemo = strMemo & CStr(records.Fields("entryType").Value) & "; "
    strMemo = strMemo & CStr(records.Fields("RER").Value)
    If IsNull(records.Fields("Contacts")) Then
    strMemo = strMemo & vbNewLine & " " & CStr(records.Fields("Memo").Value) & vbNewLine & vbNewLine
    Else
    strMemo = strMemo & "- " & CStr(records.Fields("Contacts").Value) & vbNewLine
    strMemo = strMemo & " " & CStr(records.Fields("Memo").Value) & vbNewLine & vbNewLine
    End If
    records.MoveNext
    Loop
    records.Close
    Set records = Nothing
    BuildMemoField = strMemo
    'MsgBox Len(strMemo), vbInformation, "Length of Memo"
    dbs.QueryDefs.Delete "qryUpdateMemo"
    Set qdf = Nothing
    qry1 = True
    strSQL = "SELECT * From tblProperties WHERE tblProperties.ID = " & PropertyID
    Set qdf = dbs.CreateQueryDef("qryUpdatePropMemo", strSQL)
    Dim rst As Recordset
    Set rst = qdf.OpenRecordset
    rst.Edit
    rst.Fields("Memo") = strMemo
    rst.Update
    rst.Close
    dbs.QueryDefs.Delete "qryUpdatePropMemo"
    qry2 = False
    Set qdf = Nothing
    Set dbs = Nothing
    Set records = Nothing
    Err_buildMemoField:
    MsgBox Err.Description & ": " & Err.Number
    If Not qry1 Then
    dbs.QueryDefs.Delete "qryUpdateMemo"
    ElseIf Not qry2 Then
    dbs.QueryDefs.Delete "qryUpdatePropMemo"
    Else: Exit Function
    End If
    End Function
    [/VBA]

    This is the function that it breaks on if it helps any.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

  5. #5
    VBAX Expert Imdabaum's Avatar
    Joined
    Jun 2006
    Posts
    652
    Location
    Well the SQL yielded the same result even after I tried forcing the update with RunSQL (Update.....).... so I guess I'm still at a loss why the session lock occurrs.
    Last edited by Imdabaum; 09-26-2006 at 10:42 AM.
    Someday I'll understand everything...
    Even then...I'll still pretend I'm a beginner.

Posting Permissions

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