D
dbartelt
Guest
Hello,
I use a command button to post an invoice amount. I would like to prevent accidental overwriting of a current invoice amount. This code overwrites the amount even after clicking “No”. I would like the cancel the action when “No’ is clicked. Please help!
Private Sub PostInvoice_Click()
On Error GoTo Err_PostInvoice_Click
If IsNull(InvoiceBalance) Then
[InvoiceTotal] = Me.InvoiceTotal1
[InvoiceBalance] = Me.InvoiceTotal1
[DueDate] = Me.InvoiceDate + 30
Else
MsgBox "You are about to overwrite the current invoice balance"
MsgBox "Are you sure you want to overwrite the current invoice amount", vbYesNo
If vbYes Then
[InvoiceTotal] = Me.InvoiceTotal1
[InvoiceBalance] = Me.InvoiceTotal1
[DueDate] = Me.InvoiceDate + 30
Else
Exit Sub
End If
End If
Exit_PostInvoice_Click:
Exit Sub
Err_PostInvoice_Click:
MsgBox Err.Description
Resume Exit_PostInvoice_Click
End Sub
I use a command button to post an invoice amount. I would like to prevent accidental overwriting of a current invoice amount. This code overwrites the amount even after clicking “No”. I would like the cancel the action when “No’ is clicked. Please help!
Private Sub PostInvoice_Click()
On Error GoTo Err_PostInvoice_Click
If IsNull(InvoiceBalance) Then
[InvoiceTotal] = Me.InvoiceTotal1
[InvoiceBalance] = Me.InvoiceTotal1
[DueDate] = Me.InvoiceDate + 30
Else
MsgBox "You are about to overwrite the current invoice balance"
MsgBox "Are you sure you want to overwrite the current invoice amount", vbYesNo
If vbYes Then
[InvoiceTotal] = Me.InvoiceTotal1
[InvoiceBalance] = Me.InvoiceTotal1
[DueDate] = Me.InvoiceDate + 30
Else
Exit Sub
End If
End If
Exit_PostInvoice_Click:
Exit Sub
Err_PostInvoice_Click:
MsgBox Err.Description
Resume Exit_PostInvoice_Click
End Sub