G
Guest
We have an Access data entry form which is bound to a sql table called
PAYMENTS. There is an exit button in the data entry form that has code that
writes the data to another table called CHECK_LOG. I've copied and pasted
this code below and omitted specific logic relating to the data fields for
the sql string and business rules logic (e.g. if client X, then set the data
for field Y in a specific way). There have been 2 instances in the past
several months where data appeared in the CHECK_LOG table, but not in the
PAYMENTS table. We have sql trace files that revealed that the entry in the
PAYMENTS table was rolled back about 1 minute after the initial time of the
transaction.
I think there is some user action that causes this, but I have no idea what
that action would be, so this I want to find a way to know right when it
happens so we can check with the user immediately and/or prevent it from
happening.
Any feedback to get me started in solving this problem is much appreciated
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
Dim strSQL As String
If (Me![txtAdjBal] - Me![PMT_AMT]) < 0 Then
If MsgBox("This will create a credit balance. Do you still want to
post this payment?", vbYesNo) = vbYes Then
cancelSwitch = False
Else
SendKeys "{ESC}", 10000
GoTo bypass
End If
End If
If IsNull(Me![PMT_AMT]) = True Or Me![PMT_AMT] = "" Then
SendKeys "{ESC}", 10000
GoTo bypass
End If
strSQL = "INSERT INTO [CHECK_LOG] (fields_here) VALUES (values_here);"
DoCmd.RunSQL strSQL
bypass:
DoCmd.Close acForm, "PAYMENTS ENTRY SCREEN"
Exit_btnExit_Click:
Exit Sub
Err_btnExit_Click:
MsgBox Err.Description
Resume Exit_btnExit_Click
End Sub
PAYMENTS. There is an exit button in the data entry form that has code that
writes the data to another table called CHECK_LOG. I've copied and pasted
this code below and omitted specific logic relating to the data fields for
the sql string and business rules logic (e.g. if client X, then set the data
for field Y in a specific way). There have been 2 instances in the past
several months where data appeared in the CHECK_LOG table, but not in the
PAYMENTS table. We have sql trace files that revealed that the entry in the
PAYMENTS table was rolled back about 1 minute after the initial time of the
transaction.
I think there is some user action that causes this, but I have no idea what
that action would be, so this I want to find a way to know right when it
happens so we can check with the user immediately and/or prevent it from
happening.
Any feedback to get me started in solving this problem is much appreciated
Private Sub btnExit_Click()
On Error GoTo Err_btnExit_Click
Dim strSQL As String
If (Me![txtAdjBal] - Me![PMT_AMT]) < 0 Then
If MsgBox("This will create a credit balance. Do you still want to
post this payment?", vbYesNo) = vbYes Then
cancelSwitch = False
Else
SendKeys "{ESC}", 10000
GoTo bypass
End If
End If
If IsNull(Me![PMT_AMT]) = True Or Me![PMT_AMT] = "" Then
SendKeys "{ESC}", 10000
GoTo bypass
End If
strSQL = "INSERT INTO [CHECK_LOG] (fields_here) VALUES (values_here);"
DoCmd.RunSQL strSQL
bypass:
DoCmd.Close acForm, "PAYMENTS ENTRY SCREEN"
Exit_btnExit_Click:
Exit Sub
Err_btnExit_Click:
MsgBox Err.Description
Resume Exit_btnExit_Click
End Sub