Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scope of memvar strSQL? 2

Status
Not open for further replies.

steve728

Programmer
Mar 16, 2003
536
US
I Dim strSQL as String in proc1 and use it within then
call a subsequent proc2 while proc1 is still open. Within proc2 I Dim another strSQL an use it also. Is there any stepping on toes because of using the same memvar. I doubt it but just wanted confirm this with my expert cyber buddies.

Steve
 
The scope of a variable declared inside a procedure is the procedure only, unless you use the Global keyword.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
What happens is the variable with the local scope will be used. There won't be "stepping on toes", but what may happen is you think you're using the module-level variable when really you are using the local variable.

Personally I use a naming convention to avoid confusion. All my global variables start with "g_", all module level variables "m_".


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top