A97:如果使用FN为变量赋值,并且FN返回Null,变量的结果值是多少? [英] A97: If you assign a variant its value using a FN and the FN returns Null, what is the resulting value of the variant?

查看:97
本文介绍了A97:如果使用FN为变量赋值,并且FN返回Null,变量的结果值是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个过程中有2行为MyVariant分配一个值 - 行

#238和第491行。当第238行运行时,值为152.当行

#491运行时,DLookup函数返回Null。我希望

MyVariant是Null。但事实并非如此。它的值仍然报告为

152.我能够通过在#491行之后立即运行

IsNull(MyVariant)来确认其值不是空的。 />

238 MyVariant = Forms!frmUSPSReturnReceipts!RROLAXchewsurBox.Colum n(3)

....

491 MyVariant = DLookup(" ; [CorrespID]"," qryCT4CurrentVehicle",

" [OTypDescription] =''AOC-CVM-203''")


如果在运行第238行之后MyVariant的值为152,那么在运行第491行后,它的值是否应该更改为Null? (也就是说,

当然,假设DLookup FN返回空)



参考:frmUSPSReturnReceipts,Sub PrimeConfBtn_Click

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

推荐答案

我以为我可能面临时间问题,所以我创建了

a新表格并将此代码放在表格上:


选项比较数据库

选项明确


私有子Command0_Click()

MyVariant = 152

MyVariant = Null

如果是IsNull(MyVariant)那么MsgBox" MyVariant'的值是Null"

End Sub


消息框每次都显示消息。所以,它确实没有时间是一个问题。


Hmmm ???我已经检查并重新检查以确定

DLookup FN返回Null。它肯定会。不知怎的,在第491行中没有发生Null到MyVariant的
分配。我不知道为什么不呢?
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?


2006年5月30日星期二01:16:37 -0400,MLH< CR **@NorthState.net>写道:


首先,我不知道你的问题的主体是如何与

主题行相关的。在491你没有得到FN和LN,而是一个

CorrespID。假设这个字段是一个标识列,那么它将是b $ b(希望对你而言)不允许空值,因此491中的MyVariant永远不会是
为空,除非OTypeDescription不存在。


也许你打算写:

491 MyVariant = DLookup(" [FN]",qryCT4CurrentVehicle",

[OTypDescription] =''AOC-CVM-203''")


-Tom。
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.
我有程序中的2行为MyVariant分配值 - 行#238和第491行。第238行运行时,值为152.当行#491运行时,DLookup函数返回Null。我希望
MyVariant是Null。但事实并非如此。它的价值仍然报告为
152。我能够通过在#491行之后立即运行IsNull(MyVariant)来确认其值不是Null。

238 MyVariant = Forms!frmUSPSReturnReceipts!RROLAXchewsurBox.Colum n(3)
..................................................................................................................... )如果在运行第238行之后MyVariant的值为152,那么在运行第491行后,它的值是否应该更改为Null? (也就是说,当然,假设DLookup FN返回Null)


参考:frmUSPSReturnReceipts,Sub PrimeConfBtn_Click
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






MLH写道:
我在一个程序中有2行,为MyVariant分配一个值 - 行#238和第491行。第238行运行时,值为152.当行#491运行时,DLookup函数返回Null。我希望
MyVariant是Null。但事实并非如此。它的值仍然报告为
152.我能够通过在#491行之后立即运行IsNull(MyVariant)来确认其值不是Null。

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

如果运行第238行后MyVariant的值为152,则运行后不应将其值更改为Null 491行? (也就是说,当然,假设DLookup FN返回Null)


它应该设置为Null。


任何机会线491实际上返回152?

什么是


MsgBox IIf(IsNull(MyVariant),MyVariant是空的, ; MyVariant ="&

MyVariant)


显示你是否在第491行后立即运行它?

参考:frmUSPSReturnReceipts ,Sub PrimeConfBtn_Click
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



这篇关于A97:如果使用FN为变量赋值,并且FN返回Null,变量的结果值是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆