Userform Validation Issue
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 |
Userform Validation Issue
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 |
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 |
All times are GMT +1. The time now is 06:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com