By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,847 Members | 2,153 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,847 IT Pros & Developers. It's quick & easy.

Microsoft Access can't find the name 'Empty' you entered in the expression

P: 4
Hi to all...

Would greatly appreciate any suggestions.

I'm trying to evaluate an expression during run-time that looks something like this:

Eval("RecordAdd_Addresses(False,"John","","Doe","N ew York","NY","11216","US","12345678","","",Empty,Emp ty,Empty)")

I get this error:

"Microsoft Access can't find the name 'Empty' you entered in the expression"

I have no idea what to do, completely blank about this error....

Please note that I have to use my convention for calling this method as shown (otherwise I would have to re-edit about 60 thousand lines of code).

Eval() works fine for me, but when using Empty as an argument to a function I get the error.

Thanks in advance.

Ilan
Mar 12 '08 #1
Share this Question
Share on Google+
2 Replies


Expert Mod 2.5K+
P: 2,545
Hi. The 'Empty' argument is not appropriate with Eval. What is passed to Eval is a string expression which is evaluated at run-time. The string you pass has no connection to the code in which the Eval statement is running, and in this context the reference to Empty within the string does not result in Eval interpreting Empty as your VB code would (as a placeholder for an uninitialised variant variable).

As an example to try to see more clearly why Eval can't interpret Empty, Eval can be used to evaluate an expression entered by the user at run time. If a user entered 20 * 40 Eval will return 800. If a user entered CInt(2.57) Eval will return 3. But, if a user enters CStr(Empty) a run-time error results, as Empty is only valid in VB code, and it simply cannot evaluate it.

I think you need to modify the header of your function RecordAdd_Addresses to set default values for the arguments passed to it. This would allow you to rewrite your Eval statement to do away with the Empty arguments altogether.

-Stewart
Mar 12 '08 #2

P: 4
I appreciate your help. I'll try that.
Mar 12 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.