AccessNewbe
Programmer
Greetings all,
Although I have many years programming and database experience I am a babe in the woods when it comes to working with Microsoft Access and VBA. I am currently developing a prototype for a new system and Access 2003 is the only tool that I have available (long story – don’t ask).
So far, I have made fairly good progress and found the answers to many of my questions right here in these wonderful forums. Unfortunately I have one problem that, after two days of research and trying many different sources, I still have not been able to resolve;
I would like to store some simple equations in a text field in my database and then retrieve and evaluate those equations in my Visual Basic program. Whenever I try to reference a variable in my equation, I get a runtime error 2482 “Microsoft Office Access can’t find the name ‘VariableName’ you entered in the expression”.
For example:
strFormulaText = “numActualWidth * numActualHeight / 144”
numActualArea = Eval(strFormulaText)
Will result in the runtime error while:
strFormulaText = “12 * 12 / 144”
numActualArea = Eval(strFormulaText)
Works fine.
I have found enough here ( to suspect that the variables I am using need to be declared in a class and fully qualified. However, I have not been able to get the example in the noted thread to work.
If anyone has any insights as to how I might accomplish this I would certainly appreciate hearing from you!
Best wishes and thanks in advance,
Todd Bailey
Although I have many years programming and database experience I am a babe in the woods when it comes to working with Microsoft Access and VBA. I am currently developing a prototype for a new system and Access 2003 is the only tool that I have available (long story – don’t ask).
So far, I have made fairly good progress and found the answers to many of my questions right here in these wonderful forums. Unfortunately I have one problem that, after two days of research and trying many different sources, I still have not been able to resolve;
I would like to store some simple equations in a text field in my database and then retrieve and evaluate those equations in my Visual Basic program. Whenever I try to reference a variable in my equation, I get a runtime error 2482 “Microsoft Office Access can’t find the name ‘VariableName’ you entered in the expression”.
For example:
strFormulaText = “numActualWidth * numActualHeight / 144”
numActualArea = Eval(strFormulaText)
Will result in the runtime error while:
strFormulaText = “12 * 12 / 144”
numActualArea = Eval(strFormulaText)
Works fine.
I have found enough here ( to suspect that the variables I am using need to be declared in a class and fully qualified. However, I have not been able to get the example in the noted thread to work.
If anyone has any insights as to how I might accomplish this I would certainly appreciate hearing from you!
Best wishes and thanks in advance,
Todd Bailey