[AccessD] Multi-Select List Box problems
Stuart McLachlan
stuart at lexacorp.com.pg
Sun Sep 5 17:05:30 CDT 2021
But in this case, where it's just a list of Worksation IDs, it's simpler to iterate through and
build a comma separated list which is you wrap in "WorkstationID IN("... ")"
Your report would use a recordsource query returning all workstations ( grouped by Project )
and your Docmd.OpenReport would include the "IN" clause as the "filter" parameter.
On 5 Sep 2021 at 8:06, Rocky Smolin wrote:
From: Rocky Smolin <rockysmolin2 at gmail.com>
Date sent: Sun, 5 Sep 2021 08:06:16 -0700
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Multi-Select List Box problems
Send reply to: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
> When I had this problem, I iterated through the listbox (you can do
> this with just the selected items) and add create a WHERE clause
> MyField1 = value OR MyField2 = value, etc. append that to the SQL of
> the query which opens the recordset.
>
> Crude but it works.
>
> r
>
>
>
> On Sun, Sep 5, 2021 at 6:59 AM Arthur Fuller <fuller.artful at gmail.com>
> wrote:
>
> > Actually that description is slight inaccurate. Here is a brief
> > overview of the situation:
> >
> > 1. A Customer has multiple Projects
> > 2. A Project has multiple Workstations.
> > 3. A workstation may have multiple issues
> >
> > Currently the code presents the user with a combo box to select the
> > customer of interest. A multi-select list box presents the user with
> > the Projects for the selected Customer. On clicking a Project the
> > list bo x containing the Workstations for that Project. From there
> > the user can print a report that lists the issues for one selected
> > Workstation. It is written using a recordset that finds all the
> > issues for one Worksation.
> >
> > I have been asked ti change the code so that multiple projects can
> > be selected, and within those, multiple workstations can be
> > selected. I changed the list boxes to multi-select, and a button on
> > the form accumulates the Workstation IDs and turns them into a
> > comma-separated list wrapped in a SQL IN() clause.
> > and the multi-select code
> > This all works fine. But I'm not sure how to bridge the gap between
> > the recordset code, which was written originally to deal with only
> > one Workstation at a time. I'm not tied to the SQL IN() approach.
> > I've also considering using an array or a collection of Workstation
> > IDs. One thing that occurred to me is to expand the recordset to
> > include all the selected workstations rather than dealing with them
> > one by one. One downstaream advantage is that the final report could
> > do the whole thing in a single pass, and generate a single report.
> >
> > Any thoughts on this subject?
> >
> >
> > Currently the code
> >
> > --
> > Arthur
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
More information about the AccessD
mailing list