PDA

View Full Version : Solved: can't update Memo field in Replica



Imdabaum
07-07-2006, 10:55 AM
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.

Imdabaum
07-10-2006, 12:54 PM
This was solved... I inserted

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

Imdabaum
09-15-2006, 12:41 PM
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?

Imdabaum
09-15-2006, 12:46 PM
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


This is the function that it breaks on if it helps any.

Imdabaum
09-26-2006, 09:49 AM
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.