VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Validate items on a form

by smartaddins.com (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 26th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Validate items on a form

Rate Validate items on a form



'****************************
'RUNS ALL FUNCTIONS
'By SmartAddins.com
'****************************
    Dim intRetVal As Integer
    
    'CALL VALIDATION FUNCTION
    intRetVal = FormInputs_Validate()
    If intRetVal <> -1 Then
        GoTo Exit_Command1_Click
    End If
    
Exit_Command1_Click:
    Exit Sub
    
End Sub
'****************************************************************


Function FormInputs_Validate()
'VALIDATE THE FORMS INPUTS

    Dim strMsgVal As String
    
    'CHECK THE FIRST NAME TEXT BOX
    If IsNull(txt_FirstName) Then
        strMsgVal = "Please enter value for First Name." & vbCrLf
    End If
    
    'CHECK THE LAST NAME TEXT BOX
    If IsNull(txt_LastName) Then
        strMsgVal = strMsgVal & ("Please enter value for Last Name." & vbCrLf)
    End If
    
    'CHECK THE ADDRESS TEXT BOX
    If IsNull(txt_Address) Then
        strMsgVal = strMsgVal & ("Please enter value for Address." & vbCrLf)
    End If
    
    'DISPLAY MESSAGE IF NEEDED
    If strMsgVal > "" Then
        MsgBox strMsgVal, vbExclamation
    Else
        FormInputs_Validate = -1
    End If
    
End Function

Download this snippet    Add to My Saved Code

Validate items on a form Comments

No comments have been posted about Validate items on a form. Why not be the first to post a comment about Validate items on a form.

Post your comment

Subject:
Message:
0/1000 characters