by anonymous (267 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 11th August 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Input data, Need help inputing date and correct code.
Dim Message(10) As String
Private Sub cmdExit_Click()
End
End Sub
Private Sub cmdValidate_Click()
Dim i As Integer
txtDate = Date
End Sub
Message(0) = "Please Enter Date as mm/dd/yy or mm-dd-yy"
Message(1) = "Please Enter SSN as nnnnnnnnn"
Message(2) = "First Name is Required"
Message(3) = "Last Name is Required"
Message(4) = "City is Required"
Message(5) = "State is Required"
Message(6) = "Zip Code is Required"
Message(7) = "All entries correct"
lblMessage = ""
If Not IsDate(txtDate) Then
lblMessage = Message(0)
txtDate.SetFocus
Exit Sub
End If
' check ssn
If txtSSN = "" Or Len(txtSSN) <> 9 Or Not IsNumeric(txtSSN) Then
lblMessage = Message(1)
txtSSN.SetFocus
Exit Sub
End If
' check names
If txtFirstName = "" Then
lblMessage = Message(2)
txtFirstName.SetFocus
Exit Sub
End If
If txtLastName = "" Then
lblMessage = Message(3)
txtLastName.SetFocus
Exit Sub
End If
If txtCity = "" Then
lblMessage = Message(4)
txtCity.SetFocus
Exit Sub
End If
If cboState = "" Then
lblMessage = Message(5)
cboState.SetFocus
Exit Sub
End If
If txtZip = "" Or Not IsNumeric(txtZip) Then
lblMessage = Message(6)
txtZip.SetFocus
Exit Sub
End If
lblMessage = Message(7)
txtDate.SetFocus
End Sub