By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,390 Members | 1,584 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,390 IT Pros & Developers. It's quick & easy.

Split a list in two

P: n/a
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
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Susan wrote:
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


assuming you have a pk field called "id"

Listbox1
Select top 50 percent [fieldnames] from query order by [whatever]

ListBox2
Select [fieldnames] from query where id not in (Select top 50 percent id
from query order by [whatever]) order by [whatever]

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.