Code not kicking off

  • Thread starter Thread starter Stephanie
  • Start date Start date
S

Stephanie

Hi. I can't figure out why a couple portions of my (not
so great) code won't kick off (see snippet below). I put
breaks in my code (thanks to an earlier post reply!). I
think maybe I need a lesson in "0" vs. "null" as well.
Currently I have:
Me!Option1 = -1
Me!Option2 = 0
Me!MemberStatusName = 0
Me!MemberTypeName = 0
Me!StateOrProvinceName = Null

These 2 sections of code won't kick off but I think they
should based on my current values. Any suggestions? (I'm
trying to get ready to use some streamlined code
suggested by Allen Browne but I need to make sure I can
kick it off correctly). Thanks, Stephanie
#1
....
If (Not IsNull(Option1) Or Not IsNull(Option2)) Then
If IsNull(Me!MemberStatusName) Or IsNull(Me!
MemberTypeName) Then
....
#2
....
If Not IsNull(Option1) Or Not IsNull(Option2) Then
If IsNull(Me!StateOrProvinceName) Then
....
 
hi,
me.option1 = False
me.option1 = False
me.memberstatusname = Null
me.membertypename = Null
me.statorProvencenmae = Null
0(zero) is a number and can be used in mathmatic(except
devide by)
Null is nothing. not text, not number nothing. access
cannot evaluate null becasue there is nothing to evaluate.
Access can add 0+0 but it cannot add 0+Null.
 
What do you mean by "not kicking off"? Since there is no decision making in
this code, apparently it is inside a subroutine and the event that executes
the code is not firing. Copy all your code in the subroutine and then delete
it. Go to the event you want to execute the code and delete what is there.
Then click on the three dots at the right to create a new subroutine. Paste
your code into that subroutine.
 
The Anonymous Code Crusader! Thank you- you jogged my
memory on 0 vs. null. I forgot that some of the
statements I am using as conditionals have fields that
contain numbers rather than text. Doing the step through
helped because if it told me that MemberStatusName = 0
rather than null, I could tell that my conditional
statment need to have 0 rather than null. So much better-
all of my conditionals kicked off! Thanks, Stephanie
 
Thanks PC. I didn't quite understand, but I did get the
conditionals to fire. Thanks, Stephanie
 
Back
Top