J
John S
"Save button madness" here
I am working with a form / subform (continuous form) arrangement, and trying
to put together relatively bulletproof validation. Of course, with bound
forms, there is no "save" button, and thus (I believe) forrm level
validation (ie. testing of all controls before saving) is not possible.
I have spent about three or four days experimenting with , in particular,
the before update event. This simple code does not appear to prevent the
user from entering nothing into a field. Here is a sample
Private Sub txtSex_BeforeUpdate(Cancel As Integer)
If IsNull(txtSex.Value) Or txtSex.Value = "" Then
MsgBox "Vous devez mettre la sexe de l'animal", , aTitle
Cancel = True
End If
If Not (UCase(txtSex.Value) = "F" Or UCase(txtSex.Value) = "M") Then
MsgBox "vous devez mettre 'M'[male] ou 'F' [ female]", , aTitle
Cancel = True
End If
End Sub
The event works if I enter something into the text field, and then erase it
(the isnull part anyway)), but does not prevent the user from clicking
around the particular text box to another, or even tabbing through an empty
textbox. Is there something I'm missing here that would avoid this kind of
problem in a form / subform arrangement.? Or is it back to creating that
save button with unbound forms and temporary tables?
John S
Aylmer, PQ
I am working with a form / subform (continuous form) arrangement, and trying
to put together relatively bulletproof validation. Of course, with bound
forms, there is no "save" button, and thus (I believe) forrm level
validation (ie. testing of all controls before saving) is not possible.
I have spent about three or four days experimenting with , in particular,
the before update event. This simple code does not appear to prevent the
user from entering nothing into a field. Here is a sample
Private Sub txtSex_BeforeUpdate(Cancel As Integer)
If IsNull(txtSex.Value) Or txtSex.Value = "" Then
MsgBox "Vous devez mettre la sexe de l'animal", , aTitle
Cancel = True
End If
If Not (UCase(txtSex.Value) = "F" Or UCase(txtSex.Value) = "M") Then
MsgBox "vous devez mettre 'M'[male] ou 'F' [ female]", , aTitle
Cancel = True
End If
End Sub
The event works if I enter something into the text field, and then erase it
(the isnull part anyway)), but does not prevent the user from clicking
around the particular text box to another, or even tabbing through an empty
textbox. Is there something I'm missing here that would avoid this kind of
problem in a form / subform arrangement.? Or is it back to creating that
save button with unbound forms and temporary tables?
John S
Aylmer, PQ