473,387 Members | 1,391 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1881
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: MLH | last post by:
I have a line of code that works when called from a procedure in Access 2.0 form... PlaySound("C:\cr\help\Help0018.wav", 0) I imported what I thought was needed into A97. However, running it...
8
by: MLH | last post by:
A97 HELP shows the proper syntax for using Nz as Nz(variant) I'm wondering what to expect from potential past misuse I've made. For example, consider the following... Private Sub...
44
by: MLH | last post by:
You have a table - tblOwners. Two of its fields are strOwnrFName and strOwnrLName. Would you make the default value "" (ZLS) most of the time?
37
by: MLH | last post by:
For example: Nz(,0) returns "300" if the value in field is 300 (currency data type) and "0" if the value is zero or null. I get strings in the query output - they are all left aligned and I...
2
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the...
2
by: David W. Fenton | last post by:
I think at various times we've all encountered this problem: A subform is on a main form. From the code of the main form we refer to some property of/control on the child form thus: ...
14
by: matevzb | last post by:
The C99 standard describes snprintf() in an awkward way, so it's hard (for me) to assume what the result will be in some situations. 1. The "Description" section states: "... Otherwise, output...
42
by: blisspikle | last post by:
I tried closely copying some code that I found on this group for assigning a type at runtime, but I cannot get it to work. Can someone see what is wrong with my logic? Thanks, Private Sub...
11
by: The Frog | last post by:
Hi all, Maybe I am just missing something simple here, but I seem to have an issue with a callback function in A97 that is used to fill a Listbox with values. The first time the callback...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.