Results 1 to 2 of 2

Thread: Shorter way to fill all null txtboxes

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    Greenville
    Posts
    73

    Post

    My question is close to the last persons but a little diff:
    I want to populate all of the textboxes that are null with "Must Enter" until they are filled in with info. What is an easier or shorter way to do it rather than addressing each individual textbox as 'if null then'?

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Springfield, IL
    Posts
    124

    Post

    Try this code to see if it works with what you are trying to do.
    Code:
    Private Sub Command1_Click()
    
        ' This code will loop through all controls on your form.
        ' It will only process the textboxes.
        Dim Thing As Variant
        
        For Each Thing In Form1
            If TypeOf Thing Is TextBox Then
                If Thing.Text = "" Then
                    ' Do what you need to do
                End If
            End If
        Next Thing
    
    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
  •  



Click Here to Expand Forum to Full Width