I have 10 unbound combo boxes on a form. Users will use these to selected
the desired attributes for display and printing. The problem I'm having is
determining if the combo box has a value.
I'm looking for an automated way of checking them, rather than 10
IF..THEN..ELSE codes. All combo boxes have similar names
Form![myform![combo1], form![myform]![combo2],etc. Can I set up a FOR LOOP
or something to step through them easily and assign a variable the values?
>I have 10 unbound combo boxes on a form. Users will use these to selected
> the desired attributes for display and printing. The problem I'm having is
[quoted text clipped - 4 lines]
> Form![myform![combo1], form![myform]![combo2],etc. Can I set up a FOR LOOP
> or something to step through them easily and assign a variable the values?
You can easily do this in a loop for referencing the ComboBox names...
For i = 1 to 10
If Not IsNull(Me.Controls("combo" & i)) Then
...
Next i
...but, i have no idea how you would automatically refer to the 10 different
variables. If there is a way to refer to a variable name using a string I am
not aware of it.

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Bill Edwards - 27 Jan 2007 16:19 GMT
In line
>>I have 10 unbound combo boxes on a form. Users will use these to selected
>> the desired attributes for display and printing. The problem I'm having
[quoted text clipped - 18 lines]
> different variables. If there is a way to refer to a variable name using
> a string I am not aware of it.
Perhaps use an array.
Could use a two dimensional array: column 1 = the name of the field in the
report to filter, column 2= the value retrieved from the corresponding combo
box.
Justin - 28 Jan 2007 14:13 GMT
That works great. Thanks.
> >I have 10 unbound combo boxes on a form. Users will use these to selected
> > the desired attributes for display and printing. The problem I'm having is
[quoted text clipped - 15 lines]
> variables. If there is a way to refer to a variable name using a string I am
> not aware of it.