Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / January 2007

Tip: Looking for answers? Try searching our database.

Unbound Combo Box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Justin - 27 Jan 2007 15:06 GMT
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?
Rick Brandt - 27 Jan 2007 15:14 GMT
>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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.