ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pop-up Error Messages (https://www.excelbanter.com/excel-programming/287696-pop-up-error-messages.html)

rbaxter[_4_]

Pop-up Error Messages
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Pop-up Error Messages
 
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)

"rbaxter " wrote in message
...
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."

Thanks


---
Message posted from http://www.ExcelForum.com/




rbaxter[_5_]

Pop-up Error Messages
 
thank

--
Message posted from http://www.ExcelForum.com


Arne[_3_]

Pop-up Error Messages
 
You could use the Userform_QueryClose event, which is
fired when the form is closed.


All times are GMT +1. The time now is 06:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com