Error: Identifier <variable name> out of scope

  • Thread starter Thread starter Tim Roop
  • Start date Start date
T

Tim Roop

I have recently compiled for the first time an application that I converted
from VB6. I am using Adobe's PDF.OCX as a control in the application. Last
evening after compiling, I had a strange thing happen to where I could no
longer see the control in the application nor could I find the OCX on my
machine. I reinstalled Adobe's PDF viewer and managed to get the control
reinstalled but now I am running into another issue of which I'm not really
sure where to go with...

In the Watch window I now see the following when I compile and run the app
from the IDE...

Search error: identifier 'Search'out of scope
dssoldtocust error: identifier 'dssoldtocust' out of scope
dssoldtocust1.name error: identifier 'dssoldtocust1' out of scope
dssoldtocust("NAME").value error: identifier 'dssoldtocust' out of scope
search error: identifier 'search' out of scope

In the sample above, I'm not certain about the first "Search" but the other
4 lines I can identify...

dssoldtocust is the schema for a dataset (dssoldtocust1) that was generated
from SOLDTO_CUST dataadapter
"search" is a variable name that is identified in a module.

I guess my question is... Is there a problem?? The code actually compiles
and executes fine in the IDE. The only problem I have is in the Watch
window... and if so, how do I go about fixing it??
 
I guess my question is... Is there a problem?? The code actually compiles
and executes fine in the IDE. The only problem I have is in the Watch
window... and if so, how do I go about fixing it??

Well, probably your problem is the variables are... yeah, you guessed, "out
of scope".
For the watch window to work, your code execution should be in a scope,
somewhere. Put a breakpoint whenever those variables with those names would
be accesible (as if they'd work if you wrote exactly that in your code), and
the Watch window should make its magic.

Hope this helps,

Javier Campos
 
Hi Tim,

The Watch window allows you to enter expressions and variables to evaluate.
The Watch window will display the current status and assignment (if any) for
each of these variables.

When a variable is out of scope (not defined in the current context), that
is precisely what the Watch window will show. I would guess that these
variables were of interest at some time, and had been entered and never
removed (the IDE is smart enough to "remember" them between sessions). If
you are not actively monitoring these variables, I would simply delete them
from the Watch window.

HTH,
Derrick
 
Back
Top