|
-
Mar 11th, 2004, 08:01 PM
#1
Thread Starter
Junior Member
Text Box validation problem!!!!!
Hi,
Im trying to validate a txt box,
If txtoverdraft.Text = "No", I want it so that any instance of no e.g. No, nO, no, NO what would I use here?
VB Code:
If txtoverdraft.Text = "No" And txtbalance.Text < 0 Then
'if its not at the end of the file
If (Not datCities.Recordset.EOF) And (Not datCities.Recordset.EOF) Then
'Message box
MsgBox "Overdraft not available for this client, Please enter balance greater than 0"
txtbalance.Text = ""
'Doesn't save
Action = 0
txtbalance.SetFocus
End If
End If
Thanks joePC
-
Mar 11th, 2004, 08:06 PM
#2
Lively Member
Code:
If UCase(txtoverdraft.Text) = "NO"
Which compares them both as caps. With the second condition, you should really test it as a number, because at the moment it is a string comparison
Code:
CInt(txtbalance.Text) < 0 Then
-
Mar 11th, 2004, 08:28 PM
#3
Frenzied Member
-
Mar 11th, 2004, 08:52 PM
#4
Thread Starter
Junior Member
VB Code:
If Not UCase(txtoverdraft.Text) = "NO" Or Not UCase(txtoverdraft.Text) = "YES" Then
'if its not at the end of the file
If (Not datCities.Recordset.EOF) And (Not datCities.Recordset.EOF) Then
'Message box
MsgBox "Overdraft must be YES or NO"
txtoverdraft.Text = ""
'Doesn't save
Action = 0
txtoverdraft.SetFocus
End If
End If
The value must be yes / YES / YEs etc.. or No / No/ nO etc.......
How would I do this,
Thanks joePC
-
Mar 11th, 2004, 09:04 PM
#5
Frenzied Member
Why dont you just convert it all to UCase and save yourself some headaches.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|