Split A List In Two

  • Thread starter Thread starter Susan
  • Start date Start date
S

Susan

I want to put the records returned by a query into two listboxes. The records
are presorted in this query. If there are an even number of records, I want the
first half of the records in the first list box and the last half in the second
listbox. If there are an odd number of records, I want 50% +1 of the records in
the first listbox and the remaining records in the second listbox. For example,
15 records: 8 in #1 and 7 in #2.

How do I write the rowsource expressions for the two listboxes?

Thanks!

Susan
 
Susan

Yes, this can probably be done ... but why?

If you describe the underlying business need that you are trying to solve in
this manner, the 'group readers may be able to offer an alternate solution.

Look into the Count() function, plus Mod, plus the TOP property, plus
"unmatched" queries, plus ... (This is not an insignificant undertaking.)
 
Jeff,

Thank you for responding to my post!

I have a form that displays the records returned by a dynamic crosstab query.
The query returns fifteen columns and twenty one rows. The columns are numbered
because there was not enough room for labels. I need to put a legend on the form
to identify the columns and will use two side-by-side list boxes because there
is not enough room for a list box with fifteen rows but there is for one with
eight rows with the other containing seven rows. I think I am very capable of
doing this "insignificant undertaking" of creating the two listboxes!

Susan
 
Susan

It sounds like a(n unspoken) requirement is that all possible rows be
displayed at once. I'm a little confused how you could have room for two
list boxes, totaling 15 rows, but not room for one, totaling 15 rows?

Also, is there a "natural" distinction you could use (instead of "half plus
1") to divide up the output?

A couple of the functions I mentioned in my earlier response are the
functions I would use to:
pick the TOP 50%
pick the 'remainder' (unmatched query)

It sounds like you already can handle using these two outputs as the sources
for your two listboxes.
 
Back
Top