PDA

View Full Version : Intermitant #Deleted Error



Movian
01-07-2010, 08:29 AM
Hey,
i problem where by intermitantly a field that is updated directly in a table will instead of updating. Will Crap itself and display #Deleted in that field only, at this point nothing can be done with the field. The Rest of the record is fine, the only solution i have found to resolve this is to duplicate the record and in the new record remove the #Deleted text. THis fixes the symptom but i am for the life of me unable to locate that cause.

I have attached the code from the Sub that deals with the table, i have removed all other code (for now) for easier reading (i wrote this code a while ago and havn't had a chance to optimize it or make it more palitable)

Dim mydb As DAO.Database
Dim myrs As DAO.Recordset

Set mydb = CurrentDb()
Set myrs = mydb.OpenRecordset("ConclusionImpression")
With myrs
.index = "PrimaryKey"
.Seek "=", Forms("frmMain").MedicalID
End With
If myrs.NoMatch Then
MsgBox "Patient not found in table", vbCritical, "ERROR!"
Else
myrs.Edit
'Code that based on a number of checkboxes updates the myrs.field systematicaly

' here is an example
If D3C2 = True Then
If dflag3 = False Then
FixedLoc = "anterolateral"
myrs.Fields("infarction") = myrs.Fields("infarction") + "anterolateral"
dflag3 = True
Else
If D3C3 = False And D3C4 = False And D3C5 = False And D3C6 = False And D3C7 = False And D3C8 = False And D3C9 = False _
And D3C10 = False And D3C11 = False And D3C12 = False And D3C13 = False And D3C14 = False Then
FixedLoc = FixedLoc + " and anterolateral"
myrs.Fields("infarction") = myrs.Fields("infarction") + " and anterolateral"
Else
FixedLoc = FixedLoc + ", anterolateral"
myrs.Fields("infarction") = myrs.Fields("infarction") + ", anterolateral"
End If
End If
End If
'End example - All other lines match this layout.

myrs.Update
End If
myrs.Close
Set myrs = Nothing
mydb.Close
Set mydb = Nothing
Any Help with this would be appreciated and while code optimizations are appreciated. This code works for now and i need to resolve the problem rather than making the code more efficient . Thanks

~Edit

Just to save people time i have continued to research this problem after posting (as i always do ;) ) and this is not the same as the more common issue
Where EVERY field in a record displays #Deleted

In this case only a SINGLE field is affected. We have also just had our first case of this happening in another table in another field.... This field however has no code that affects it making the situation even more confusing.... any help is apriciated.