call a constant

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

Guest

I need to assign a value of a constant to a variable:

var=cstrConstant

I'm looking up the name of the constant in a table (from ADODB recordset rs):

var = rs.Fields("MyConstant")

But this makes the code think I want to assign the name of the constant to
var. How do I get the value of the constant? (I think this must be painfully
obvious, but I can't think of it right now).

Thanks!!
 
Hi Sam

I don't think you can call a constant that way.

Design the table so it has a record for each constant (not a field), and use
a second field to hold the value associated the the constant. You can then:
DLookup("MyValueField", "MyTable", "MyConstant = """ & cstrConstant &
"""")
 
Back
Top