Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Check UserForm Values Before Saving
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Saving Userform as Gif | Excel Programming | |||
Automaticly saving formula's to values when saving | Excel Discussion (Misc queries) | |||
UserForm value check | Excel Programming | |||
Spell Check Within a UserForm? | Excel Programming | |||
Can't check checkboxes in userform ... sometimes | Excel Programming |