Hello.
I was wondering if I can use a seperate MODULE which is run by a macro to validate a form?
The following code is sited within the Event procedure of a form, but I really would prefer this to be in a seperate Module. Which is run by a macro using a 'complete survey' button on the form?
is this possible? I.e. Renaming the top of the code as follows:
Private Sub Form_BeforeUpdate(Cancel As Integer)
To contain the form name?
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.EntranceDoorsFlats.Value <> "None" And Len(Me.EntranceDoorsFlatsQuant & "") = 0 Then
Cancel = True
MsgBox "Entrance Door Selected: Quant Required!"
If Len(Me.EntranceDoorsFlatsQuant & "") = 0 Then
Me.EntranceDoorsFlatsQuant.SetFocus
Me.EntranceDoorsFlatsQuant.BackColor = vbRed
End If
End If
If Me.EntranceDoorsFlats.Value <> "None" And Len(Me.EntranceDoorsFlatsRenewYear & "") = 0 Then
Cancel = True
If (Me.EntranceDoorsFlatsRenewYear & "") = 0 Then
Me.EntranceDoorsFlatsRenewYear.SetFocus
Me.EntranceDoorsFlatsRenewYear.BackColor = vbRed
End If
End If
End Sub