Forum Discussion

jchrisj's avatar
jchrisj
Copper Contributor
Sep 10, 2020

Module level variables

I am an experienced Access developer using Office 2013.

I have a form module where two module-level variables have their values set in the form open event, but when later checked in a button click event on the same form show as empty (one is string, the other boolean).

I have explicit turned on and have compacted/repaired and compiled.

Changing the variables from module to global fixes the issue, but that solution is not optimum.

Never seen this behaviour before. Any clues anyone?

Cheers

 

Chris

  • Never seen the behaviour you describe, but without seeing your code it is hard to say for sure.

    Are you in development where errors may occur testing the variables?
    Have you decompiled and recompiled?
    Why not use TempVars?
    • jchrisj's avatar
      jchrisj
      Copper Contributor

      Daniel_Pineault 

      see below...

      Are you in development where errors may occur testing the variables? Not that I'm aware of.
      Have you decompiled and recompiled? Yes, it did not help
      Why not use TempVars?

      Why use Tempvars when the method I am trying to use is used elsewhere in the same database and works well. One other thing I omitted to mention is the if I step through the code in the form open event where the variable is assigned, and then put a breakpoint in the code where it is used - it works just fine. But if I just use the breakpoint at the place the variable is tested without stepping through the assignment - it fails.

      Perhaps there has been a recent update that has stuffed things up?

Resources