need suggestion for options

  • Thread starter Thread starter Tom Hanley
  • Start date Start date
T

Tom Hanley

I am creating a form that offers several check boxes. The use can choose any
combination of check boxes. I then want to populate a field on the form with
the results. Sounds simple and I'm sure it is. I am trying to make it in an
effecient manner. I could hard code the choices and build a string but I
wanted to loop thru the check boxes, test for if checked, grab the
corresponding label and add that to the variable string. I have numbered the
check boxes and labels with corresponding numbers 1-21. My main problem is
that when I build a string in the loop to test the field on the form, it
doesn't recognize the name as a field.

for example:

Do While counter <= 21
wkreq = "check" + Str(counter)
wkdesc = "label" + Str(counter) + ".Caption"
If Me!wkreq <> nil Then <---this is where it fails now
X = X + ", " + wkdesc
End If
counter = counter + 1
Loop
Me!Work_req_desc = X

What is the best way to gather the options/check box/list/combobox info?
Should I be using an array?
 
me(wkreq) should work just fine.

Not sure where you defined "nil", but you cannot go:


if <some condistion> = Null then

The above is nonsense, so, you can use


if isnull(me("some contorl name")) = true then
 
Back
Top