469,625 Members | 1,059 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

A97: If you assign a variant its value using a FN and the FN returns Null, what is the resulting value of the variant?

MLH
I have 2 lines in a procedure that assign MyVariant a value - line
#238 and line #491. When line #238 runs, the value is 152. When line
#491 runs, the DLookup function returns Null. I would expect
MyVariant to be Null. But it is not. Its value is still reported as
152. I'm able to confirm its value is not Null by running
IsNull(MyVariant) immediately after line #491.

238 MyVariant = Forms!frmUSPSReturnReceipts!RROLAXchewsurBox.Colum n(3)
....
491 MyVariant = DLookup("[CorrespID]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

If the value of MyVariant is 152 after running line #238, shouldn't
its value be changed to Null after running line 491? (that is, of
course, assuming the DLookup FN returns Null)


reference: frmUSPSReturnReceipts, Sub PrimeConfBtn_Click
May 24 '06 #1
11 1708
MLH
I thought I might be facing a timing issue, so I created
a new form and put this code on the form:

Option Compare Database
Option Explicit

Private Sub Command0_Click()
MyVariant = 152
MyVariant = Null
If IsNull(MyVariant) Then MsgBox "MyVariant's value is Null"
End Sub

The message box displays the message each time. So, it does
not seem that timing is an issue.

Hmmm??? I've checked and rechecked to be certain that the
DLookup FN returns Null. It most certainly does. Somehow the
assignment of Null to MyVariant is not occuring in line #491. I
don't understand why not?
May 24 '06 #2
On Tue, 30 May 2006 01:16:37 -0400, MLH <CR**@NorthState.net> wrote:

First off, I don't see how the body of your question pertains to the
subject line. In 491 you're not getting a FN and LN, but rather a
CorrespID. Assuming this field is an identity column, it would
(hopefully for you) not allow nulls, so MyVariant in 491 would never
be null, unless the OTypeDescription does not exist.

Perhaps you meant to write:
491 MyVariant = DLookup("[FN]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

-Tom.
I have 2 lines in a procedure that assign MyVariant a value - line
#238 and line #491. When line #238 runs, the value is 152. When line
#491 runs, the DLookup function returns Null. I would expect
MyVariant to be Null. But it is not. Its value is still reported as
152. I'm able to confirm its value is not Null by running
IsNull(MyVariant) immediately after line #491.

238 MyVariant = Forms!frmUSPSReturnReceipts!RROLAXchewsurBox.Colum n(3)
...
491 MyVariant = DLookup("[CorrespID]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

If the value of MyVariant is 152 after running line #238, shouldn't
its value be changed to Null after running line 491? (that is, of
course, assuming the DLookup FN returns Null)


reference: frmUSPSReturnReceipts, Sub PrimeConfBtn_Click


May 24 '06 #3
DFS
MLH wrote:
I have 2 lines in a procedure that assign MyVariant a value - line
#238 and line #491. When line #238 runs, the value is 152. When line
#491 runs, the DLookup function returns Null. I would expect
MyVariant to be Null. But it is not. Its value is still reported as
152. I'm able to confirm its value is not Null by running
IsNull(MyVariant) immediately after line #491.

238 MyVariant = Forms!frmUSPSReturnReceipts!RROLAXchewsurBox.Colum n(3)
...
491 MyVariant = DLookup("[CorrespID]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

If the value of MyVariant is 152 after running line #238, shouldn't
its value be changed to Null after running line 491? (that is, of
course, assuming the DLookup FN returns Null)
It should be getting set to Null.

Any chance line 491 actually returns 152?

What does

MsgBox IIf(IsNull(MyVariant), "MyVariant is Null", "MyVariant = " &
MyVariant)

show if you run it immediately after line 491?
reference: frmUSPSReturnReceipts, Sub PrimeConfBtn_Click

May 24 '06 #4
MLH
>First off, I don't see how the body of your question pertains to the
subject line. In 491 you're not getting a FN and LN, but rather a
CorrespID. Assuming this field is an identity column, it would
(hopefully for you) not allow nulls, so MyVariant in 491 would never
be null, unless the OTypeDescription does not exist.

Perhaps you meant to write:
491 MyVariant = DLookup("[FN]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

-Tom.

Tom - excuse my poor grammar. I should have written out
"DLookup Function" instead of "DLookup FN". The latter
can imply that what I was trying to look up was the 2-char
string "FN". Oops. My bad.

I did get to the bottom of it all. It was a stupid mistake I made
resulting in a logic error. I'm too embarassed to point it out and
bring more attention to the issue on this forum.
May 24 '06 #5
MLH
<snip>
It should be getting set to Null.

Any chance line 491 actually returns 152?

What does

MsgBox IIf(IsNull(MyVariant), "MyVariant is Null", "MyVariant = " &
MyVariant)

show if you run it immediately after line 491?

Please excuse me. My logic was out of whack. I was reporting my
presumed erroneous at a completely unrelated point in code. The
condition was NOT in error. The variant was being set to Null, as
you said it should be. I installed my checkpoint in the wrong place.
So sorry. Thx 4 offering to help.
<snip>
May 24 '06 #6
On Tue, 30 May 2006 11:52:05 -0400, MLH <CR**@NorthState.net> wrote:

You already embarrased yourself by having your computer clock be 5
days ahead. Fix that.

-Tom.
First off, I don't see how the body of your question pertains to the
subject line. In 491 you're not getting a FN and LN, but rather a
CorrespID. Assuming this field is an identity column, it would
(hopefully for you) not allow nulls, so MyVariant in 491 would never
be null, unless the OTypeDescription does not exist.

Perhaps you meant to write:
491 MyVariant = DLookup("[FN]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

-Tom.

Tom - excuse my poor grammar. I should have written out
"DLookup Function" instead of "DLookup FN". The latter
can imply that what I was trying to look up was the 2-char
string "FN". Oops. My bad.

I did get to the bottom of it all. It was a stupid mistake I made
resulting in a logic error. I'm too embarassed to point it out and
bring more attention to the issue on this forum.


May 25 '06 #7
DFS
Tom van Stiphout wrote:
On Tue, 30 May 2006 11:52:05 -0400, MLH <CR**@NorthState.net> wrote:

You already embarrased yourself by having your computer clock be 5
days ahead. Fix that.
It's very doubtful his system clock has anything to do with it. The
originating timestamp should have been assigned by his ISP news server.

I'm testing it right now; I closed Outlook Express, set my system clock
ahead one week, reopened OE and now I'm replying.

-Tom.
First off, I don't see how the body of your question pertains to the
subject line. In 491 you're not getting a FN and LN, but rather a
CorrespID. Assuming this field is an identity column, it would
(hopefully for you) not allow nulls, so MyVariant in 491 would never
be null, unless the OTypeDescription does not exist.

Perhaps you meant to write:
491 MyVariant = DLookup("[FN]", "qryCT4CurrentVehicle",
"[OTypDescription]='AOC-CVM-203'")

-Tom.

Tom - excuse my poor grammar. I should have written out
"DLookup Function" instead of "DLookup FN". The latter
can imply that what I was trying to look up was the 2-char
string "FN". Oops. My bad.

I did get to the bottom of it all. It was a stupid mistake I made
resulting in a logic error. I'm too embarassed to point it out and
bring more attention to the issue on this forum.

May 25 '06 #8
"DFS" <nospam@dfs_.com> wrote in news:hN9dg.58891$MM6.19395
@bignews3.bellsouth.net:
Tom van Stiphout wrote:
On Tue, 30 May 2006 11:52:05 -0400, MLH <CR**@NorthState.net> wrote:

You already embarrased yourself by having your computer clock be 5
days ahead. Fix that.


It's very doubtful his system clock has anything to do with it. The
originating timestamp should have been assigned by his ISP news server.

I'm testing it right now; I closed Outlook Express, set my system clock
ahead one week, reopened OE and now I'm replying.


Now you are replying in Xnews land.

But, I think you are not now replying in Google land. This is good because
in Google land there is nothing (yet) to which to reply.

--
Lyle Fairfield
May 25 '06 #9
"DFS" <nospam@dfs_.com> wrote in
news:hN*******************@bignews3.bellsouth.net:
Tom van Stiphout wrote:
On Tue, 30 May 2006 11:52:05 -0400, MLH <CR**@NorthState.net>
wrote:

You already embarrased yourself by having your computer clock be
5 days ahead. Fix that.


It's very doubtful his system clock has anything to do with it.
The originating timestamp should have been assigned by his ISP
news server.

I'm testing it right now; I closed Outlook Express, set my system
clock ahead one week, reopened OE and now I'm replying.


Your post shows up dated May 31st.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
May 25 '06 #10
DFS
David W. Fenton wrote:
"DFS" <nospam@dfs_.com> wrote in
news:hN*******************@bignews3.bellsouth.net:
Tom van Stiphout wrote:
On Tue, 30 May 2006 11:52:05 -0400, MLH <CR**@NorthState.net>
wrote:

You already embarrased yourself by having your computer clock be
5 days ahead. Fix that.


It's very doubtful his system clock has anything to do with it.
The originating timestamp should have been assigned by his ISP
news server.

I'm testing it right now; I closed Outlook Express, set my system
clock ahead one week, reopened OE and now I'm replying.


Your post shows up dated May 31st.


It did in my newsreader as well, but for some reason (forward dated I guess)
it's still not indexed in Google, but your's and Lyle Fairfield's are.

If you look in the headers of my "May 31st" post, it shows

NNTP-Posting-Date: Wed, 24 May 2006 23:47:25 EDT

I thought that ISP-attached date would replace whatever my newsreader
timestamp says.
May 25 '06 #11
Australia, Easter Standard Time, his post shows up
dated June 1.

(david(

"David W. Fenton" <XX*******@dfenton.com.invalid> wrote in message
news:Xn**********************************@127.0.0. 1...
"DFS" <nospam@dfs_.com> wrote in
news:hN*******************@bignews3.bellsouth.net:
Tom van Stiphout wrote:
On Tue, 30 May 2006 11:52:05 -0400, MLH <CR**@NorthState.net>
wrote:

You already embarrased yourself by having your computer clock be
5 days ahead. Fix that.


It's very doubtful his system clock has anything to do with it.
The originating timestamp should have been assigned by his ISP
news server.

I'm testing it right now; I closed Outlook Express, set my system
clock ahead one week, reopened OE and now I'm replying.


Your post shows up dated May 31st.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/

May 27 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Jim McGivney | last post: by
2 posts views Thread by David W. Fenton | last post: by
14 posts views Thread by matevzb | last post: by
42 posts views Thread by blisspikle | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.