Use of Eval with Access Recordset

ewandavis

New member
Local time
Today, 16:29
Joined
May 26, 2008
Messages
2
In some Access 2003 VBA code have

strEval = "rsMatter_Details!" & !Database_Name

With the value of Database name in the first record

strEval correctly contains “rsMatter_Details!Matter_ID”

debug.print rsMatter_Details!Matter_ID prints the correct value

but debug.print Eval(strEval) gives me the error “"microsoft office access can't find the name ‘rsMatter_Details” you entered in the expression

Where am I going wrong? Can I use Eval in this way

Thanks.
 
No, you can not use local variables or objects within an Eval expression that way. May I ask why you want to use it that way? Surely we can find another way. Are you perhaps trying this?
Code:
Debug.Print rsMatter_Details.Fields(!Database_Name)
 
No, you can not use local variables or objects within an Eval expression that way. May I ask why you want to use it that way? Surely we can find another way. Are you perhaps trying this?
Code:
Debug.Print rsMatter_Details.Fields(!Database_Name)

Thanks Erik your alternative approach does what I was trying to do with Eval

Ewan
 

Users who are viewing this thread

Back
Top Bottom