Gasman
Enthusiastic Amateur
- Local time
- Today, 03:51
- Joined
- Sep 21, 2011
- Messages
- 15,640
Just seen a post on another site, where Dims are buried in an if block way down in the code. Saying that some are not even used even after being set.
I have always DIMmed mine at the top of a sub/function.
Sometimes they might not get used, if they are set inside an if block like this member has done (not sure it his code TBH though)
Now some people will say that is inefficient as you are declaring variables that might not get used?
I prefer to have them all in one place, so I can easily see if I forgot one, or need to change it's type for some reason, rather than have to hunt them down in all the code.
Might be a hangover from my COBOL days, but how do you Access professionals approach this?
I have always DIMmed mine at the top of a sub/function.
Sometimes they might not get used, if they are set inside an if block like this member has done (not sure it his code TBH though)
Now some people will say that is inefficient as you are declaring variables that might not get used?
I prefer to have them all in one place, so I can easily see if I forgot one, or need to change it's type for some reason, rather than have to hunt them down in all the code.
Might be a hangover from my COBOL days, but how do you Access professionals approach this?