Eval Function

BigJimSlade

Registered User.
Local time
Today, 18:25
Joined
Oct 11, 2000
Messages
173
Hi, Big Jim here:

Ok, here is my problem. I try to run this code:

strServer = Left(CurrentDb.Name, 1) 'Gives me "c"
strServer = Eval("GetDriveType(strServer)")

The problem falls within the second line of code. When I run it, I get an error telling me that Microsoft can't find the name 'strServer' I entered in the expression. How could I run this so that it sees strServer as the variable from line 1?


Thanks in advance!

Big Jim
 
Last edited:
try

strServer = Eval("GetDriveType(" & strServer & ")")
 
Hmmmm, when I changed the code to this:

strServer = Left(CurrentDb.Name, 1) 'Value of "C" which is needed for the function
strServer = Eval("GetDriveType(" & strServer & ")")

It tells me that Access can't find the name "C" I entered in the expression.


Any thoughts?

Thanks!

Big Jim
 
Last edited:
Ok....

I need to add some single quotes like this:


strServer = Eval("GetDriveType('" & strServer & "')")

Thanks for your help!


Big Jim
 

Users who are viewing this thread

Back
Top Bottom