Messing with ListBox columns

H

H. Martins

ListBox columns are always (please confirm) displayed by the same
order as query columns with 'show'.

When a column is added on the right side there is no problem, but in
the left side there is a side effect. Every code that reads the
content of a column has to be updated to point to the next (right)
column.

Is there any way to avoid this side effect? Can I refer to a column by
name instead of by number?

Thanks
H. Martins
 
R

Roger Carlson

As far as I know, you can only refer to a listbox column by its index
number. However, if you are doing this in code, you could create Gobal
Constants giving names to each of the column index numbers. Then you could
use the constant instead of the actual index number. This would allow you
to change the code in only one place (the global constant section), to
change your references.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
C

crazyaccessprogrammer

I avoid looking up data from an sql bound to a drop-down box for the very
reason you describe. Insert a field in front of other fields you had
previously looked up in VBA code via the MyControlName.Column(x) function and
suddenly you gotta change a bunch of numbers in the .Column(x)

Instead, use dlookup to find the value you want instead.
 

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