• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 151
  • Last Modified:

Check for data in textboxes and comboxes

I have attached a file.  In it, you will see that I have a VB6 form with many rows of inputting information.

What I am trying to do is make sure the form gets filled out completely.  For example.  If a person enters a date and CCMs, then the form needs to check that the rest of the row is filled out otherwise they cannot click Next.

How can I accomplish this?

0
al4629740
Asked:
al4629740
  • 4
  • 4
  • 2
1 Solution
 
GrahamSkanRetiredCommented:
The file appears to be more detached than attached - i.e. you seem to have forgotten it.
0
 
al4629740Author Commented:
0
 
Martin LissOlder than dirtCommented:
A few questions.

Are the controls all members of control arrays? For example are the controls under 'Date" named like Mydate(0), MyDate(1), etcetera?

Do all rows have to be completed or is just a few rows okay as long as all the fields are filled out in those rows?

Can the user skip a row, for example fill in rows 1,2, 4 1nd 5?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
GrahamSkanRetiredCommented:
Sorry. That doesn't seem to be very helpful. I have loaded it as a Word document.

However, I don't really understand how it could contain a VB6 form,
0
 
Martin LissOlder than dirtCommented:
Private Sub cmdNext_Click()
    Dim intCount As Integer
    Dim bOK As Boolean
    
    ' This doesn't care about skipped rows
    
    bOK = True
    For intCount = 0 To txtDate.Count - 1
        If txtDate(intCount).Text <> "" Then
            If txtCCM(intCount).Text > "" And _
               cboMtgType(intCount).Text > "" And _
               cboSubType(intCount).Text > "" And _
               txtPurpose(intCount).Text > "" Then
               ' Row OK
            Else
                bOK = False
                Exit For
            End If
        End If
    Next
    
    If bOK Then
        MsgBox "One or more rows not completely filled out"
        Exit Sub
    End If
    
    ' The rest of the code in the sub goes here
            
End Sub


Private Sub txtDate_Change(Index As Integer)

    cmdNext.Enabled = False
    
End Sub

Open in new window

0
 
Martin LissOlder than dirtCommented:
Sorry, line 22 should be

If Not bOK Then
0
 
al4629740Author Commented:
Thanks Martin!

I will take a look at it shortly
0
 
al4629740Author Commented:
Are the controls all members of control arrays? For example are the controls under 'Date" named like Mydate(0), MyDate(1), etcetera?
Yes

Do all rows have to be completed or is just a few rows okay as long as all the fields are filled out in those rows?
No

Can the user skip a row, for example fill in rows 1,2, 4 1nd 5?
yes
0
 
al4629740Author Commented:
I made a couple changes and it works like a champ.  Thanks again


Dim intCount As Integer
    Dim bOK As Boolean
    
    ' This doesn't care about skipped rows
    
    bOK = True
    For intCount = 0 To MR6Date.Count - 1
        If MR6Date(intCount).text <> "" Then
            If MR6CCM(intCount).text <> "" And _
               MR6MtgType(intCount).text <> "" And _
               MR6SubType(intCount).text <> "" And _
               MR6Purpose(intCount).text <> "" Then
               ' Row OK
            Else
                bOK = False
                Exit For
            End If
        End If
    Next
    
    If bOK = False Then
        MsgBox "One or more rows not completely filled out"
        Exit Sub
    End If

Open in new window

0
 
Martin LissOlder than dirtCommented:
Glad I could help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now