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:
Expand|Select|Wrap|Line Numbers
- 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
Expand|Select|Wrap|Line Numbers
- 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.