Quote:
Originally Posted by inlanoche
It seems that sometimes the Global Var (public userRole as String) holds a value, and sometimes resets....
If I could better understand that, it may be usable for what I need.
|
Simply declaring a variable as public or global doesn't prevent it being reset. For example, with:
Public userRole as String
userRole can be cleared from any sub or function with code like:
userRole = ""
If you want to prevent userRole being reset use code like:
Const userRole As String = "Manager"
Note also that having:
Option Explicit
at the top of your code module will protect you from having something like:
Public userRole as String
but then referencing it as:
useRole
in your code - which quite understandably would come back as a null string.