Replace NULL values from database for MSFLEXGRID

How can I replace empty or NULL values pulled from a database and display them as "Unknown" or just an empty string? I'm using MSFLEXGRID and I need it to display something when no value is present, because I am pulling data using msflexgrid.text and editting it in a textbox. Any help would be appreciated...
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add 2 double quotes on the end of each field value. e.g.

Dim sMyString as String
sMyString = MyRecordset.Fields(1).Value & ""

This will just give the string a value of an empty string if the recordset value is null and won't cause any error.

YeavisAuthor Commented:
Okay I understand what you're saying.. but the column on the flexgrid could or could not contain information. Basically I have an inventory program and some information might not apply to all inventory items. When the grid is filled I need to replace any empty values.. so when the user clicks on a row to edit the information the text boxes can be filled without generating an error.
I'm not sure I quite understand what you are trying to do. When do you get the error?
You can replace empty values in a FlexGrid with anythin you like e.g.:

Private Sub Command1_Click()
    Dim i As Long
    Dim j As Long
    With MSFlexGrid1
        For i = 0 To .Rows - 1
            For j = 0 To .Cols - 1
                .Row = i
                .Col = j
                If .Text = "" Then
                    .Text = "f " & i & " " & j
                    .Text = "Row  " & i & " Col " & j
                End If
            Next j
        Next i
    End With

End Sub
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

YeavisAuthor Commented:
Okay the code you gave me worked! The only strange thing is that when i click on one of them I see a bunch of ROW 1 COL 1 (or whatever the row and column are) dislayed as text until the grid itself is populated from the database. Is there anyway to hide this?
hi Yeavis

instead of using Text property in above code.

try to use .TextMatrix(row, col) property of MSFlexGrid..
YeavisAuthor Commented:
I tried changing the code to use textmatrix but it is giving an invalid argument error. Could you please modify the above code and show me what I did wrong? Thank you..
  Dim Row As Long
    Dim Col As Long

    With MSFlexGrid1
   while not rs.eof
      for col= 0 to rs.fileds.Count-1
      .TextMatrix(Row,Col) = Rs(Col) 'where RS(i) is the Field data for which u want  
     Row = Row + 1

Also If uy could post ur code.. i might help u better way
    End With
In the If statement in my previous message change:

   .Text = "Row  " & i & " Col " & j


  .Text = " "

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YeavisAuthor Commented:
Worked beautifully.. thank you very much for the help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.