optiaccess
New member
- Local time
- Today, 15:09
- Joined
- Oct 7, 2018
- Messages
- 2
Hello there,
I have a form in which I want to validate fields.
The following code is working well in the Form_BeforeUpdate event
I would also like Access to check fields in case i'm missing something in my code, so I set the Required property to yes and added the following in the Form_Error event
But now my Form_BeforeUpdate Message is not showing neither before nor after the one from the Error event.
I want Form_Error and Form_BeforeUpdate both to show their custom message.
Would it be posible to allow access to check required fields and at the same time use my validations in the Form_BeforeUpdate Event?
I have a form in which I want to validate fields.
The following code is working well in the Form_BeforeUpdate event
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.OrderNumber) Or Me.OrderNumber& "" = "" Then
MsgBox "Must enter Order Number", vbInformation
Cancel = True
With Me.OrderNumber
.SetFocus
.Undo
End With
End If
End Sub
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = "3314" Then
MsgBox "Must enter data.", vbExclamation
Response = acDataErrContinue
End If
End Sub
I want Form_Error and Form_BeforeUpdate both to show their custom message.
Would it be posible to allow access to check required fields and at the same time use my validations in the Form_BeforeUpdate Event?