DaveyCrockett
Programmer
Hello all!
I have a dilemma. I have an application that is retrieving null values from the database and when I try to concatenate all of the retieved fields (ie.. grs.Fields(0) & grs.Fields(1) & grs.fields(2))
let's say Field(0) = "Hello"
Field(1) = null
Field(2) = "What is your Name"
if I try to print this out, say like a msgbox. If value 1 is a null string, my output gets cut off prematurely... I would only get "Hello" in my msgbox.
Does anyone know how to go through each of the values and if it is null, replace that value (for the entire length) with spaces or zeros..
I tried this, but the Replace is not working:
Dim i As Integer
i = 0
For i = 0 To 54 'i have 55 fields to check/ a big table
'get the length of the field
Debug.Print grs.Fields(i).Name & ": " & grs.Fields(i).DefinedSize & " ** Actual Size: " & grs.Fields(i).ActualSize
Dim str As String
Dim fieldsize As Long
str = grs.Fields(i).Value
If IsNull(grs.Fields(i).Value) Then
grs.Fields(i).Value = Replace(IsNull(str), Val(str), "0", 1, grs.Fields(i).DefinedSize)
Debug.Print grs.Fields(i).Value
End If
Next i
any help would be greatly appreciated.
Thanks
I have a dilemma. I have an application that is retrieving null values from the database and when I try to concatenate all of the retieved fields (ie.. grs.Fields(0) & grs.Fields(1) & grs.fields(2))
let's say Field(0) = "Hello"
Field(1) = null
Field(2) = "What is your Name"
if I try to print this out, say like a msgbox. If value 1 is a null string, my output gets cut off prematurely... I would only get "Hello" in my msgbox.
Does anyone know how to go through each of the values and if it is null, replace that value (for the entire length) with spaces or zeros..
I tried this, but the Replace is not working:
Dim i As Integer
i = 0
For i = 0 To 54 'i have 55 fields to check/ a big table
'get the length of the field
Debug.Print grs.Fields(i).Name & ": " & grs.Fields(i).DefinedSize & " ** Actual Size: " & grs.Fields(i).ActualSize
Dim str As String
Dim fieldsize As Long
str = grs.Fields(i).Value
If IsNull(grs.Fields(i).Value) Then
grs.Fields(i).Value = Replace(IsNull(str), Val(str), "0", 1, grs.Fields(i).DefinedSize)
Debug.Print grs.Fields(i).Value
End If
Next i
any help would be greatly appreciated.
Thanks