Eval("Name of Field")

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

A column in a query:
Data: Eval(FieldName())

In a general Module:
Public Sub FieldName() As String
FieldName = "Name of Field"
End Sub

when run, the query should EVALUATE the name of the field returned in the
query and look up the value of that field for each record. Instead it puts
"Name of Field" in each record. Would not the purpose of evaluate be to
change from a string to code?
 
Na rijp beraad schreef MDB-HZA :
A column in a query:
Data: Eval(FieldName())

In a general Module:
Public Sub FieldName() As String
FieldName = "Name of Field"
End Sub

when run, the query should EVALUATE the name of the field returned in the
query and look up the value of that field for each record. Instead it puts
"Name of Field" in each record. Would not the purpose of evaluate be to
change from a string to code?

It's doing exactly as you code. The function returns "Name of Field" so
that's what you get in your query... I'm not sure what you'd expect it
to return, please explain a little bit further...
 
The Eval() function attempts to determine the value of an expression -- see
Access HELP for examples. When you use Eval(FieldName()), it appears you
are telling Access that the field name is an expression.

Are you trying to determine what is IN the field with that field name? If
so, you could just use the field name in your query...
 

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

Back
Top