Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
leo leo is offline
external usenet poster
 
Posts: 74
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default 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


  #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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
userform date issue Woodi2 Excel Worksheet Functions 4 February 7th 09 02:18 PM
UserForm Issue Thomas[_21_] Excel Programming 5 August 10th 06 02:46 PM
UserForm Save Issue DarnTootn Excel Worksheet Functions 0 May 11th 06 05:15 PM
Userform Issue Bill[_30_] Excel Programming 3 January 21st 06 02:27 PM
UserForm Listbox issue bach Excel Discussion (Misc queries) 29 October 6th 05 01:48 PM


All times are GMT +1. The time now is 08:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"