|
-
May 18th, 2007, 08:50 PM
#1
Thread Starter
Member
control array
Hello,
I have a validate routine that works fine as is but I need to be able to let the user cancel if they wish, before completing the form. They cannot do so this way. I want to create my own procedure and attach it to the save command so the form is completed before it validates but I cannot seem to get it right.Could someone explain how to create a procedure using a control array
Here is what I have for the validate. This just checks to see if the textboxes are empty.
Public Sub txtFields_Validate(Index as Integer, KeepFocus As Boolean)
Dim dmv As String
If txtFields(Index) < 1 Or txtFields(Index) > 21 Then Exit Function
If Len(txtFields(Index).Text) > 0 Then Exit Function
dmv = ""
Select Case Index
Case 2
dmv = "Issued to"
Case 3
dmv = "Contact"
Case 4
dmv = "Phone"
Case 5
dmv = "Permit Amount"
Case 6
dmv = "Check or Cash"
Case 11
dmv = "County Road"
Case 12
dmv = "Location"
Case 13
dmv = "Desc of work"
Case 14
dmv = "Authorized BY"
Case 15
dmv = "Issued BY"
End Select
If dmv <> "" Then
KeepFocus = True
txtFields(Index).BackColor = vbYellow
txtFields(Index).ToolTipText = ("The " & dmv & " Field may not be left Blank.")
End If
End Sub
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
|