Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VB6 ADODB.Recordset.Field = NULL Error

1 view
Skip to first unread message

A. Scott White

unread,
Sep 2, 1999, 3:00:00 AM9/2/99
to
Last night, I discovered something:

MyRecordSet.Field("Age") = NULL
MyRecordSet.Update
If IsNull(MyRecordSet.Field("Age")) Then
MsgBox "It worked!"
Else
MsgBox "It didn't work. Dang!."
End If

The second pithy message box always pops up. The IsNull always returns
false. However, the Database does contain a Null! That's great, or at
least less sucky than when I thought it wasn't working at all. Now my
program works, it just doesn't know it.

It's like the Value property of the Field object gets filled with some
value (possibly Empty or Nothing) that VB doesn't recognize as a Null,
even though a Null is inserted into the database. When I hover above
the field (in debug mode), no ToolTip appears to show me a value. When
I hover over any other field, the value is displayed in a ToolTip.
When I hover over a field that is recognized as Null (with IsNull) a
ToolTip with the word "Null" appears. When I hover over a field that
is recognized as Empty (with IsEmpty) a ToolTip with the word "Empty"
appears. When I hover over a field that is recognized as Nothing (with
Is Nothing) a ToolTip with the word "Nothing" appears.

This is something else, an anomaly. I wonder if I'm opening some
space/time vortex. I'm not sure, but I will research more. Perhaps I'm
mad to delve into these things, but I must know. My assistant is
obviously concerned, and scared...THE FOOL! Can't he see that we are
on the verge of one of the greatest programming discoveries of all
times!!! Let him cower, let them all question me, call me mad. D@MN
THEM ALL!!! They'll know I was right when I break through! I'm close!
I KNOW it!! I can FEEL it!!!!!

[Editor's note: This was the last log entry...the last known words of
Mr. White. As of today, his whereabouts are unknown.]

No, but seriously, has anyone ever seen this behavior before?

==================================
A. Scott White
Senior Systems Analyst
Affiliated Computer Services, Inc.
scottw....@coderite.com
==================================


Doug Steele

unread,
Sep 2, 1999, 3:00:00 AM9/2/99
to
Just out of curiosity, what happens if you change the instruction to:

MsgBox "It didn't work. Instead, you've got " &
MyRecordSet.Field("Age")

--

Beer, Wine and Database Programming. What could be better?
Visit "Doug Steele's Beer and Programming Emporium"
http://webhome.idirect.com/~djsteele/

Jim in Cleveland

unread,
Sep 3, 1999, 3:00:00 AM9/3/99
to
"A. Scott White" wrote:
>
> Last night, I discovered something:
>
> MyRecordSet.Field("Age") = NULL
> MyRecordSet.Update
> If IsNull(MyRecordSet.Field("Age")) Then
> MsgBox "It worked!"
> Else
> MsgBox "It didn't work. Dang!."
> End If
>
> The second pithy message box always pops up. The IsNull always returns
> false. However, the Database does contain a Null!
<snip>

It is unfortunate that you discovered this, Mr. White. For now, you
know too much, and that knowledge jeopardizes the agenda of the
Organization...
Seriously, dude, ya gotta get outta the lab! I think this was Doug's
point about displaying MyRecordSet.Fields("Age") - you'd see the value.
A few things: when you do the Refresh, you reload the recordset - so
you are now positioned at the first record, which is not necssarily the
one where you set the field value to Null.
Another thing - some updates are not instantaneous, so your code may
evaluate the "If IsNull" before the update actually occurs.
Plus, using ADO on an Access97 db, the Refresh actually seems to
interfere with update - I set up a grid bound to an ADO DataControl, and
made a command button to set one field of the selected row to Null (like
the start of your code). When I included the Refresh statement, the
grid would not show that the field had changed to Null (even though I
could open the table in Access and see it was now blank). When I took
out the Refresh, after the field was set to Null the grid updated just
fine to show that field go blank.
--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"

"What's so funny 'bout peace, love & understanding?"
- Nick Lowe

0 new messages