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 &
"""")
 

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

Similar Threads


Back
Top