View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
leo leo is offline
external usenet poster
 
Posts: 74
Default Userform Validation Issue

Thanks JW. This works perfectly.

"JW" wrote:

Try:
If Me.TextBox1 = ""
Or
If Len(Me.TextBox1) = 0

Leo wrote:
I am trying to build validations into a userform to make sure that all
requested data is entered. However, the validation is not working, allowing
null values to be saved, which is not good given that the form feeds a
database through ADO code.

I think the problem is that I typically program VBA in Access, and likely
have an Excel VBA syntax issue. Below is an example of the code I am using to
validate. Any suggestions?

Thanks,
Leo

Private Sub btnSubmit_Click()
On Error GoTo catch

'Validate form inputs
If IsNull(Me.txtName.Value) Then
MsgBox "Please enter customer's name!", , "INFO REQUIRED"
Exit Sub
End If
Exit Sub