Erite Conflict Error - Dirty is not Working

E

Eka1618

Hello,

I posted this problem in a different thread, but I cannot seem to come up
with a solution for my problem yet.

I've had this Write conflict error for almost 3 weeks now. Al Kallal has
tried to help me, but his solution just does not work for some reason.

I am trying to force a disk write using the following code:

If Me.Dirty = True Then
Me.Dirty = False ' force disk write of data
End If

I guess that only place I could put this code is in the click event of
btnSend. When a user click btnSend, the STATUS of the current record changes.
This is causing the error.

I am not sure where else to put this dirty statement, nor has it been
working for me. The only time I get it to work is if I have it written the
way the code below demonstrates. However, it will only work durring the time
I have the database open. For instance, I re-type the dirty statement, and it
works only durring that current session for some reason. If I close the DB,
re-open it and try to run the btnSend click event again, it stops working and
the message comes back but the code is still there...

I just do not know what else to do, because every thread I've read about
this proposes using the dirty statement. There must be another way to get
this to dissapear.... If anyone knows what I can do please let me know, Thank
You!

~Erica~

'***********************************************************
'btnSend will send an e-mail to the test requestor stating that the test has
been conducted
'***********************************************************
Private Sub btnSndResults_Click()
On Error GoTo btnSend_Click_Err

Dim emName As String, varItem As Variant
Dim emailBody As String
Dim emailSubject As String

'DoCmd.OpenQuery "qryUpdateQueueStatus", acViewNormal
If Me.Dirty = True Then
Me.Dirty = False ' force disk write of data
End If

Me.STATUS = "IN REVIEW" 'Me.txtReview

emailSubject = "Test Queue ID has been Conducted"

On Error GoTo btnSend_Click_error
If Me.lboRequestor.ItemsSelected.Count = 0 Then
MsgBox "Please select a test requestor"
Exit Sub
End If

Me.txtRequest.SetFocus

emailBody = "Hello," & vbCrLf & vbCrLf & _
"The product test request for Request Number: " & txtRequest.Text

Me.txtQID.SetFocus

emailBody = emailBody + " has had a test conducted for Test Queue: " & QID &
"." & vbCrLf & vbCrLf & _
"To review, Please log into the Product Engineering Database." & vbCrLf &
vbCrLf & _
"Thank You!"

On Error GoTo btnSend_Click_error
If Me.lboRequestor.ItemsSelected.Count = 0 Then
MsgBox "Please select a test requestee"
Exit Sub
End If

For Each varItem In Me.lboRequestor.ItemsSelected
emName = emName & Chr(34) & lboRequestor.Column(2, varItem) & Chr(34) & ","
Next varItem

'remove the extra comma at the end
'add the requestor to the e-mail list recipients
emName = Left$(emName, Len(emName) - 1)

'send message
Me.Visible = False
DoCmd.SendObject acSendNoObject, , , emName, , , emailSubject, emailBody,
False, False
DoCmd.Close acForm, "frmQueueID", acSaveNo
DoCmd.OpenForm "frmMain", acNormal
DoCmd.Close acForm, "frmResults", acSaveNo

btnSend_Click_error:
If Err.Number = 2501 Then
MsgBox "You just canceled the e-mail", vbCritical, "Alert"
End If

btnSend_Click_Exit:
Exit Sub

btnSend_Click_Err:
MsgBox Error$
Resume btnSend_Click_Exit

End Sub
 
E

Eka1618

Well, I have tried a new method where I set the Record Locks property to
"Edited Record" and still include the dirty statement. This seems to be
working for now. If anyone else has any info about this then I'd still like
to know what other options there are regarding the error just incase this
method fails in the future.

Thank You!

~Erica~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top