Listbox - possible to repeat same columns?

B

bb67dart

I am using a listbox on a form that is linked to a query. Currently
there are about 25 records being returned in the query, so the list
fits on the form as a listbox that is wide enough to display the 2
columns (in this case).

But I would like to know if there is a way to repeat those same two
columns to the right of the original two columns? That would allow the
listbox size to be set to the width of say 6 columns, and the same
field in column 1 would be shown in column 3 and column 6. And the
number of records would of course dictate whether the data would spill
over into the repeat columns.

Is this a possibility in a single listbox? It seems it would be
possible with 3 separate list boxes, and changing the query link to
include records 1-25, then 26-50, etc.
 
D

Douglas J. Steele

The listbox will show whatever's in the RowSource. If you use a query that
repeats fields, the repeated fields will be shown in the list box.
 
P

Peter Hibbs

Two possible methods you could consider.

1. Create a temporary table (in the front-end if your DB is split)
with 6 fields called say A,B,C,D,E & F. Whenever you need to display
the List box you would need to empty this table and fill it with data
from your source table, copy the two fields from the first 25 records
into fields A & B, the next 25 records to fields C & D and the last 25
records into fields E & F. Then bind the List box to a query based on
the temporary table. This would need a lot of VB code, of course and
what happens when you need more than 75 records?

2. A more elegant method, which would also need a fair bit of VB code,
is to use a Flex Grid control instead of the List box, a bit overkill
but it will work. Have a look at the Flex Grid Demo program at :-
http://www.rogersaccesslibrary.com/...p?FID=21&SID=5debzz2c87c6957859f13b1d2zcccfb4
for an example of this.

HTH

Peter Hibbs.
 
B

bb67dart

Two possible methods you could consider.

Thanks Peter, that is helpful. I'll probably try something like your
first method, except with queries (e.g. TOP 25 from...) or perhaps
using the TOP 25 right in the properties of the listboxes.

Doug, I understand what you're saying but that fact itself is quite
obvious and does nothing help solve the problem.
 
D

Douglas J. Steele

Thanks Peter, that is helpful. I'll probably try something like your
first method, except with queries (e.g. TOP 25 from...) or perhaps
using the TOP 25 right in the properties of the listboxes.

Doug, I understand what you're saying but that fact itself is quite
obvious and does nothing help solve the problem.

Sorry, what you wanted wasn't patently obvious from your question.

I read it that you wanted particular values repeated so that when you
scrolled to the right, you'd still be able to see what was in the first
column:

Val01 Val02 Val07 Va01 Val08 Val13 Val01 Val14
Val03 Val04 Val09 Val03 Val10 Val15 Val03 Val16
Val05 Val06 Val11 Val05 Val12 Val17 Val05 Val18

Fortunately, Peter read it the other way.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top