Firstly happy new year all.
I wonder if one of you good people could show me the way
to make the following available to all forms rather than just one control on one form.I think they call it a global
I have the following check digit code for an 8 figure number, using the mod method.This aplies to one control on one form , but I would like to make it a function that I could refer to anywhere else.
Private Sub HAWBNO_Enter()
If IsNull(Me!AWBNO) Then
DoCmd.GoToControl "awbno"
Else
If IsNumeric(Me!AWP) Then
'compare first 7 digits with 8th.Mod operator returns remainder
If Val(Left(Me!AWBNO, 7)) Mod 7 = Val(Right(Me!AWBNO, 1)) Then
Me!AWBNO.ForeColor = 16711680
Else 'error in check digit
MsgBox "ERROR ! AWB CHECK DIGIT", 48, "ERROR"
Me!AWBNO.ForeColor = 255
DoCmd.GoToControl "AWBNO"
End If
End If
End If
End Sub
Mucho appreciate any help with this.
best rgds
Nick
I wonder if one of you good people could show me the way
to make the following available to all forms rather than just one control on one form.I think they call it a global
I have the following check digit code for an 8 figure number, using the mod method.This aplies to one control on one form , but I would like to make it a function that I could refer to anywhere else.
Private Sub HAWBNO_Enter()
If IsNull(Me!AWBNO) Then
DoCmd.GoToControl "awbno"
Else
If IsNumeric(Me!AWP) Then
'compare first 7 digits with 8th.Mod operator returns remainder
If Val(Left(Me!AWBNO, 7)) Mod 7 = Val(Right(Me!AWBNO, 1)) Then
Me!AWBNO.ForeColor = 16711680
Else 'error in check digit
MsgBox "ERROR ! AWB CHECK DIGIT", 48, "ERROR"
Me!AWBNO.ForeColor = 255
DoCmd.GoToControl "AWBNO"
End If
End If
End If
End Sub
Mucho appreciate any help with this.
best rgds
Nick