0

Goodday All.
I have imported data from an MS excel spreadsheet into MS Access. All goes well unit I try to populate a MSFlexgrid with an open recordset. In my code it shows me that each and every field is found except when it gets to empty field it see's the field having a NULL value and the code stops.
Below is the code where it fails

For j = 1 To AfsugRS.Fields.Count 'this loop is for Columns
argFlexGrid.TextMatrix(i, j) = AfsugRS(j - 1) 'This is where I get an error Next

argFlexGrid.TextMatrix(i, 0) = i 'i holds the S.No.
AfsugRS.MoveNext
Next

Can Anyone advise me as to how to get around this while still using the FOR statement.

Regards
Craig Allan

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by vb5prgrmr
0

A couple of ways...

... = Trim(AfsugRS(j - 1))

... = AfsugRS(j - 1) & vbNullString

Or you could try an update statement...

strSQL = "UPDATE Table1 SET Field1 = " & vbNullString & " Where Field1 = " & vbNull

(or something like that as I don't remember the last time I had to do it... it could be...)

strSQL = "UPDATE Table1 SET Field1 = " & vbNullString & " Where Field1 = Null"


Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.