Results 1 to 2 of 2

Thread: Filling all those Dang Null txt's

  1. #1

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

    Post

    OK I have been trying to get this for a while. I have tons of textboxes that I want to fill in with "Input" if there are no values from the database to pull into them. Rather than saying if isnull(blahblah) for each txt and then what I want to be filled in I know there is an easier way to just fill in all null txt's. I have been trying the following code but that sucker is not working. Also if the txt's are not Null they are going to be filled with different fields from the table so is that going to make this that much more complicated. Many Thanks to any help.


    Dim oObj3 As Object
    For Each oObj3 In Me
    If TypeOf oObj3 Is TextBox Then
    If IsNull(oObj3) = True Then

    oObj.Text = "Input"
    oObj.ForeColor = vbRed

    Else
    oObj3.ForeColor = vbBlack
    End If
    End If

    Next

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163

    Post

    Simply append the null string onto your default string:

    rs!Value & "Input"
    -> this will equal "Input" if the object is null

    I use this to avoid using is null for database fields


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