mark curtis
12-16-2000, 08:29 AM
Pat Hartman
Member posted 12-12-2000 07:37 PM
--------------------------------------------------------------------------------
You have a choice. You can write a lot of code or you can write a small amount of code. My personal choice is as little code as possible. That way I don't have to write it. I don't have to test it. And, I don't have to debug it.
In the BeforeUpdate event of the FORM put code that checks the field in question for a valid value. If it has none, cancel the update event, display a message box, and set the focus back to the field you want them to enter data into.
If IsNull(YourFld) or Len(Trim(YourFld)) = 0 Then
Cancel = True
MsgBox "Please enter data in YourFld before proceeding", VBOKOnly
Me.YourFld.SetFocus
End If
Your alternative is to put similar code in EVERY control on the form! Or, even worse, enabling and disabling controls one by one to force them into a specific navigation path through the data entry. UGH!
mark curtis
Junior Member posted 12-12-2000 11:51 PM
--------------------------------------------------------------------------------
Thanks for the replies but still have a slight problem that when I close my form the message box is still visible and I have to press it 4 times to make it go. Any clues???
Thanks
Member posted 12-12-2000 07:37 PM
--------------------------------------------------------------------------------
You have a choice. You can write a lot of code or you can write a small amount of code. My personal choice is as little code as possible. That way I don't have to write it. I don't have to test it. And, I don't have to debug it.
In the BeforeUpdate event of the FORM put code that checks the field in question for a valid value. If it has none, cancel the update event, display a message box, and set the focus back to the field you want them to enter data into.
If IsNull(YourFld) or Len(Trim(YourFld)) = 0 Then
Cancel = True
MsgBox "Please enter data in YourFld before proceeding", VBOKOnly
Me.YourFld.SetFocus
End If
Your alternative is to put similar code in EVERY control on the form! Or, even worse, enabling and disabling controls one by one to force them into a specific navigation path through the data entry. UGH!
mark curtis
Junior Member posted 12-12-2000 11:51 PM
--------------------------------------------------------------------------------
Thanks for the replies but still have a slight problem that when I close my form the message box is still visible and I have to press it 4 times to make it go. Any clues???
Thanks