Banana
06-05-2008, 02:11 PM
It's been so long since I needed to do this, and can't for life find where I put that code.
I have a bunch of constants named seed1, seed2, seed3....
I want to set a string variable to seed + integer, but I get "seed1", not the actual content of the constant named seed1....
WayneRyan
06-05-2008, 06:20 PM
Banana,
As far as I know that only works for form controls.
For i = 1 to 10
Debug.Print Me.Controls("Seed" & CStr(i))
Next i
You could probably search through the Modules collection and find the
appropriate line of code defining the constant, but I don't think that's
what you want to do.
btw, I don't think the Eval function can help here either.
Wayne
Banana
06-05-2008, 06:27 PM
You've just confirmed that I probably got confused with myself into thinking I did that before, but only with as you said, form controls but not constants.
I'll just throw them in an array and be done with it.
Thanks for the assurance. :)
WayneRyan
06-05-2008, 06:53 PM
OK, Banana,
I didn't think you really wanted to read modules searching for the value(s).
See ya,
Wayne
WayneRyan
06-05-2008, 06:58 PM
Banana,
On second thought, you could obviously store them in a table and retrieve
them by name.
Wayne
Banana
06-05-2008, 07:09 PM
True, I'm just not a big fan of using tables to hold constants when it can be hidden in a module. Maybe if the database windows allowed for grouping/organizing the tables/queries/forms objects, then I'd probably do it. :)
boblarson
06-05-2008, 07:14 PM
if the database windows allowed for grouping/organizing the tables/queries/forms objects, then I'd probably do it. :)
One new benefit of Access 2007. You can organize your items into custom categories.
Banana
06-05-2008, 07:26 PM
Yes, but I'm the kind of guy who refuses to upgrade until everything's stable. :/
Not to mention that there's a chance that Office 2007 would make everything horrible at my company, I'm afraid.