strange problem

C

congngo

I have cancel button on the main form (main member). When user
click on that button, another form will open up a smaller (form40) and
the main form still open. User has a choice to selection a cancel
reason and once a user double click on that particular reason it will
excecute the following code below and will close the form (form40)
The problem is that ,occasionally once or twice a day on one
particular user, the first 4 lines of code got executed and you can
see it on the main form but after the form40 close the data is gone.
It is like it execute the code then erased it. I probably need to do
requery

Private Sub Frame40_DblClick(Cancel As Integer)
On Error GoTo Err_Frame40_DblClick
Dim rst, rst1 As DAO.Recordset

Me.DATECANCEL = Format(Now, "mm/dd/yy") 'form main_member
Me.CANCELS = True 'form
main_member
Me.csrID = CurrentUser() 'form
main_member
Me.cancellati = [conf] + [csrID] + Format(Now, "mm/dd/yy")
'form main_member

Set rst = CurrentDb.OpenRecordset("DailyReport", dbOpenDynaset)
With rst
rst.AddNew
rst!conf = conf
rst!csrID = CurrentUser
rst!cxlreason = Me.Frame40
rst.Update
End With
rst.Close
Set rst = Nothing

With Forms![MAIN-members].Child135.Form
Set rst1 = .RecordsetClone
rst1.AddNew
rst1!conf = conf
rst1!csrID = CurrentUser
rst1!csdate = DATE
rst1!comments = "cxl"
rst1.Update
rst1.Bookmark = rst1.LastModified
End With
rst1.Close
Set rst1 = Nothing

DoCmd.Close acForm, "cancel", acSaveYes

Exit_Frame40_DblClick:
Exit Sub

Err_Frame40_DblClick:
MsgBox Err.Description
Resume Exit_Frame40_DblClick

End Sub
 

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