-
I want to perform three validations
on a particular field.the field is of
textbox type.Fieldname - code-primary key
the 3 validations are
1)cannot leave it blank
2)duplication check
3)only enter in this format 'D001'
cannot get this done
Problem-if one works another stops working
and so on
soln- i want all three should work together
NB-i have used lostfocus of textbox.
Iteration being if then...else
tried with select case,elseif,do while...loop
but did not work
-
Hi,
I didn't know exactly what you mean with duplication check ...
However, for the other two validations I have a suggestion
hope this helps :)
Nina
___________________________________________
Code:
Private Sub Text1_Validate(KeepFocus As Boolean)
If Text1 = "" Then
KeepFocus = True
MsgBox "...", , "Invalid Entry in Textbox"
Exit Sub
End If
If Not Text1 Like "[D]###" Then
KeepFocus = True
MsgBox "Doesn't match required pattern", , "Invalid Entry in Textbox"
Exit Sub
End If
'+ code for 3rd validation
End Sub
[Edited by Nina on 03-22-2000 at 08:17 AM]
-
Could you use a combobox? You can then do the duplicate validation against the members of the list.
A valid entry would then be add to the list so duplicates of THAT could not be entered.
:cool:
Dan
-
If this is an incremental value that is used just as the key, could you determine what the next key value should be and automatically populate (and disable) the control?