Results 1 to 3 of 3

Thread: Quicker Wat to Fill all Null Textboxes and other objects?

  1. #1

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

    Post

    I have a GoFind Command button that fills in all of the text, combos, etc, when clicked. There are tons of objects to be filled and I am trying to fill the ones that do not have a value entered with a different color and "Input". Is there a quicker way than the following code to fill all of these in or do I really have to go thru each object and fill it in?? Early Thanks.

    If IsNull(tb!TransAssnmtDate) = True Then
    txtDateAssnd.Text = "Input Date"
    txtDateAssnd.ForeColor = vbRed
    Else
    txtDateAssnd.ForeColor = vbBlack
    txtDateAssnd.Text = (tb!TransAssnmtDate)
    End If

    If IsNull(tb!transCompleted) = True Then
    txtTransCmpleted.Text = "Input Date"
    txtTransCmpleted.ForeColor = vbRed
    Else
    txtTransCmpleted.ForeColor = vbBlack
    txtTransCmpleted.Text = (tb!transCompleted)
    End If

  2. #2
    Member
    Join Date
    Apr 1999
    Posts
    38

    Post

    You might try something like this:

    Dim obj As Control
    For Each obj In FormName.Controls
    If TypeOf obj Is TextBox Then
    If IsNull(obj.text) Then
    '...
    Else
    '...
    End If
    End if
    Next


    you can also re-use the code by changing the type of the control (eg change TextBox into CheckBox and the code works for all checkboxex)

    [This message has been edited by Frederik Gekiere (edited 02-02-2000).]

  3. #3

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

    Post

    Hey Frederik or someone else who is looking, Thanks but I also am joing these textboxes to fields in a DB and if the object is not null then it will be filled with whatever field it matches with in the DB. Is it still possible to fill in all of them in a quicker way. I shold have mentioned the DB part at first. Thanks.

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