When True doesn't = True

G

Guest

This is driving me insane! (Access 2002)

Here is a simple bit of code in the Form_Current event that used to work and
now has suddenly stopped:

If IsNull(OpenArgs) = True Then
Me.Continue.Enabled = False
Me.Cancel.SetFocus
End If

When I step through the event and hover my mouse over the arguements I get
OpenArgs showing as "13.99" and True showing as True=True. Then the procedure
jumps to the End If without doing the two instructions!

Can anyone help me please?

I am wondering if my modules are somehow corrupt. When I type into it
sometimes it goes haywire, showing up red and the cursor jumping around as it
tries to configure my typing instead of waiting for me to press the enter key
before trying. If this is a known problem, is there any way around it.
 
A

Allen Browne

If the OpenArgs contains 13.99, then IsNull(OpenArgs) has to be False.

BTW, since IsNull() always returns True or False, there is no need to
compare it to anything. It *is* a true/false value, so just use:
If IsNull(Me.OpenArgs) Then
 
A

Andi Mayer

This is driving me insane! (Access 2002)

Here is a simple bit of code in the Form_Current event that used to work and
now has suddenly stopped:

If IsNull(OpenArgs) = True Then
Me.Continue.Enabled = False
Me.Cancel.SetFocus
End If

When I step through the event and hover my mouse over the arguements I get
OpenArgs showing as "13.99" and True showing as True=True. Then the procedure
jumps to the End If without doing the two instructions!

Can anyone help me please?

??????
if your OpenArgs has a value then isnull(OpenArgs) is false and the
condition is not True

now you compare if false=True and this is NOT True

True is everytime true, thats the reason you get True=true if you want
to know what is true.

type into the immidiate window:

?true=true
the result will be true

?false=false
the result will be true

?false=true
the result will be false
 
C

Carl Rapson

I'm not certain if I understand your problem. According to what you posted,
OpenArgs is not Null, so the two statements in the IF shouldn't be executed.

Carl Rapson
 
F

Fred Boer

Dear Mark:

With respect to the second part of your post: If you have a form open which
uses the timer event, you may have problems editing code, since the timer
event might be firing and disrupting the editing of code. Close any forms
that have timer events, then try editing code; you may find your editing
problem disappears.

HTH
Fred Boer
 
G

Guest

Thanks for all the replies. I spotted the error 20 seconds after posting and
then it took so long to appear on the site I had to go out and couldn't amend
my posting before you all tried to work out my idiotic mistake! However, it
did used to work and I now know where I went wrong. Somehow the default for
the button enable changed so that the button was disabled BEFORE I did the
test to see whether I shoud disable it. Solution: put in an else to capture
both eventualites! I wish the defaults wouldnt change like that!

However the second point was still valid and I think Fred has hit the nail
on the head. I do have a timer event and it has only been happening sonce
around the time it was introduced.

Thank you all
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top