Pop-up Error Messages

  • Thread starter Thread starter rbaxter
  • Start date Start date
R

rbaxter

Does anyone know how to generate a pop-up message when exiting a form
if 'txtFieldA' is left blank (""), that reads:

"Please fill in txtFieldA."

Thank
 
Best to have a button for exiting so that you can control it. The code
behind the button would be something like

Private Sub cmdExit_Click()

If txtFieldA.Text = "" Then
MsgBox "Must input this field"
With txtFieldA
.SelStart = 1
.SetFocus
End With
Else
Me.Hide
End If

End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top