Setting variable in API code

P

Pastor Del

I am using some API code in an Access 2000 application I'm building. In this
API code I have the following: ConnectToServer(ByVal strShareName As
String,...

The variable strShareName is being set correctly but I can not find how. No
where in the project code is this variable being set. I need to adjust the
visibility of this variable so I can disconnect the share from a different
module.
 
V

vanderghast

Search your code for ConnectToServer. The code will be in VBE environment
(Ctrl_G) and search the code with Ctrl_F. Be sure to search the entire
project.


Definitively, the calling code won't set the variable strShareName,
directly, but would do it indirectly with a call like:

ConnectToServer "SomeServer"

By the way, I would rather make a backup, and be sure you can restore the PC
from that backup, before making any modification to working code.


Vanderghast, Access MVP
 
C

Clifford Bass via AccessMonster.com

Hi Pastor Del,

The variable is set each time the ConnectToServer() function is called
(used). Do a search in your code for all calls to the ConnectToServer()
function (i.e. search for "ConnectToServer"). When you do a search you can
tell the VBA Editor to search the "Current Project" (i.e. through all modules)
.. So you may find a number it entries that look similar to this:

ConnectToServer "\\ServerName\ShareName"

or

Dim strServer As String

strServer = "\\ServerName\ShareName"
ConnectToServer strServer

That literal string or the contents of the string variables is what goes
into the strShareName variable. Note that the strShareName is local to the
ConnectToServer() function and cannot be used outside of it.

Hope that helps,

Clifford Bass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top