Hi,
I'm new to access. I have built a database and a form (along with a subform). Before the command button updates I want it to run a validation. The current VBA code for the button is:
I'm looking to add the following code in some manner:
I'm trying all kinds of different combinations and it just does not want to work. I only want the form to update if Cartons - CartonCountSubt otal = 0. Any thoughts?
Thank you in advance. This is driving me nuts.
Eddie.
I'm new to access. I have built a database and a form (along with a subform). Before the command button updates I want it to run a validation. The current VBA code for the button is:
Code:
Option Compare Database
Option Explicit
Private Sub Command20_Click()
On Error GoTo Err_Command20_Click
DoCmd.GoToRecord , , acNewRec
Exit_Command20_Click:
Exit Sub
Err_Command20_Click:
MsgBox Err.Description
Resume Exit_Command20_Click
End Sub
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.[Cartons]-Me.[CartonCountSubtotal] <> 0 Then
MsgBox "Check your carton count!"
Cancel = True
End If
End Sub
Thank you in advance. This is driving me nuts.
Eddie.
Comment