generating fieldname from string.

Roy riggsjø

Registered User.
Local time
Today, 03:20
Joined
Apr 11, 2008
Messages
11
Hell experts.

i wondering how i can generate a fieldname from a string.

for instance, in my table i have a field named "Field 26"

i want to create the [field 26] from a string with a user input nr. (UserInput as Integer)

all i need to know is how the syntax must be..
something like this?

for instance "[field" & UserInput & "]"

i want to set a value to this field like:

"[field" & Counter & "]" = True

thank you
 
Just curious, why are you having the user define field names?
 
Just curious, why are you having the user define field names?

hehe, i know its a bit strange. but im working on a project trying to reduce loops in the code.

what i need is actually if the user type in 26.
then field 26 should be set to true.

it is 52 fields.... for 52 weeks....
 
Hum...

When dealing with form controls, instead of referencing them with something like:

forms!myForm!myTextbox

You can do something like:

forms!myForm("myTextbox")

So if you get a value from another text box, say myTextBox2, then I suppose you could do something like:

forms!myForm("myTextbox" & myTextBox2)

Hope all of that makes sense and is of some help.
 

Users who are viewing this thread

Back
Top Bottom