Check UserForm Values Before Saving
What happens when that sub is exited, does it still unload?
--
HTH
Bob Phillips
"MBlake" wrote in message
...
Hi,
Prio to saving UserForm values to a worksheet I want to verify that a user
has completed all sections on the form. I have written the following code
that traps the missing entries and displays a dialog box. Unfortunately
the
dialog box then closes and rather than SetFocus the data is transferred to
the database worksheet. How can I stop the code to force the user to
complete the missing entry and click the 'Submit' buttton?
Thanks for any help,
Mickey
================================================== ========================
If ComboBoxPIN.Text = "" Then MsgBox "You Must Enter a PIN Number."
ComboBoxPIN.SetFocus
ElseIf Me.ComboBoxDate.Value = "" Then
MsgBox "You Must Enter a Date."
ComboBoxDate.SetFocus
ElseIf ComboBoxArea.Text = "" Then
MsgBox "You Must Enter a Location for this activity."
ComboBoxArea.SetFocus
ElseIf ComboBoxActivity.Text = "" Then
MsgBox "You Must Enter an Activity."
ComboBoxActivity.SetFocus
ElseIf ComboBoxOffence.Text = "" Then
MsgBox "You Must Enter an Offence."
ComboBoxOffence.SetFocus
ElseIf TextBox11.Text = "" Then
MsgBox "You Must Enter a Reference Number."
TextBox11.SetFocus
Exit Sub
End If
<following code then copies the userform values to the database worksheet
|