dsoutherland
Programmer
- Feb 26, 2004
- 15
- 0
- 0
I just converted a VB6 application/Access 97 database to Access 2000. Now code that used to retrieve data from memo fields in the tables only returns NULL. Any ideas? Interesting point is that when I run the code in debug and the data is retrieved from the table, using the immediate window I can display the data value the FIRST TIME. If I try to display the data value a second time, the data is returned NULL. Here is the code used to fill a data grid where rs is the recordset:
With grd
If (Not rs.EOF) Then
lintDBNumberOfFields = rs.Fields.Count
.Cols = lintDBNumberOfFields
ReDim ChunkyField(lintDBNumberOfFields)
llngWidth = 8 * .GridLineWidth
For lintX = 0 To lintDBNumberOfFields - 1
.Col = lintX
.Text = rs.Fields(lintX).Name
ChunkyField(lintX) = (rs.Fields(lintX).Type = adLongVarChar)
Select Case rs.Fields(lintX).Type
Case adChar, adVarChar, adVarWChar, adWChar, adLongVarChar, adLongVarWChar
.ColAlignment(lintX) = flexAlignLeftCenter
.WordWrap = True
If lintX <> 0 Then
If rs.Fields(lintX).DefinedSize > 10 Then
If rs.Fields(lintX).DefinedSize > 50 Then
If (lintX = lintDBNumberOfFields - 1) And (.Width - llngWidth > 5000) Then
.ColWidth(lintX) = .Width - llngWidth
Else
.ColWidth(lintX) = 5000
End If
Else
.ColWidth(lintX) = 80 * rs.Fields(lintX).DefinedSize
End If
Else
.ColWidth(lintX) = -1
End If
End If
Case Else
If lintX <> 0 Then
.ColWidth(lintX) = -1
End If
End Select
End if
Wend
With grd
If (Not rs.EOF) Then
lintDBNumberOfFields = rs.Fields.Count
.Cols = lintDBNumberOfFields
ReDim ChunkyField(lintDBNumberOfFields)
llngWidth = 8 * .GridLineWidth
For lintX = 0 To lintDBNumberOfFields - 1
.Col = lintX
.Text = rs.Fields(lintX).Name
ChunkyField(lintX) = (rs.Fields(lintX).Type = adLongVarChar)
Select Case rs.Fields(lintX).Type
Case adChar, adVarChar, adVarWChar, adWChar, adLongVarChar, adLongVarWChar
.ColAlignment(lintX) = flexAlignLeftCenter
.WordWrap = True
If lintX <> 0 Then
If rs.Fields(lintX).DefinedSize > 10 Then
If rs.Fields(lintX).DefinedSize > 50 Then
If (lintX = lintDBNumberOfFields - 1) And (.Width - llngWidth > 5000) Then
.ColWidth(lintX) = .Width - llngWidth
Else
.ColWidth(lintX) = 5000
End If
Else
.ColWidth(lintX) = 80 * rs.Fields(lintX).DefinedSize
End If
Else
.ColWidth(lintX) = -1
End If
End If
Case Else
If lintX <> 0 Then
.ColWidth(lintX) = -1
End If
End Select
End if
Wend