Access ListBox / ComboBox

F

Franck

taking my chance here it may be more accurate to be here
so here the copy of my problem from another group

From: Franck
Date: Mon, Dec 18 2006 3:31 pm
Groups: microsoft.public.office.developer.vba


I'm trying to put data in a list box or combobox, it work great. Ok
here the trick, i try to put itemdata in it, i can't manage to do that.
I'm a basicly a VB developper not VBA but i talk to few of my friends
and those that were able to answer me told me that they can't do that
thing either. Look like that ComboBox or listbox from VBA is not using
Windows API. I would like either way to add at least 2 parameter into
any of those 2 type of dataholder (listbox and combobox)

so a way to add item to them, way to retreive it, way to clear it (even
lstMylist.clear doesnt work)

Thanks


From: Cindy M
Date: Fri, Dec 22 2006 12:21 pm

Hi Franck,
You need to specify in which application you're working, and what with
what kind of list box or combobox. The Office applications usually have
three or four different kinds of control sets, all based on different
technologies...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or
reply in the newsgroup and not by e-mail :)


From: Franck
Date: Wed, Jan 3 2007 8:36 am

Like the title says it's in access. it's in a form that have nothing
binded to a table/request. So like i said i tried with the basic
controls in Access, the combobox/listbox by default shown in the
toolbar. i have read during the holydays that they are not the same
control as vb use, they seems to be office special controls, well i
tried to check a bit more and they were saying true, they are not
pointing to the same ocx/dll/obj. Well to make a short story i try put
in vba 2 columns of data in a list/combo (i dont care as long it's
possible with any of those)

I tried my usual : lstMybox1.additem "itemColumn1" & vbtab &
"itemColumn2"
i even tried with flexgrids i tried both version of flexgrid but i cant
make it work and i cant control it as vb but i understand that vba is
not made to match vb. i tried about 5 different codes i have found on
the internet and none work. that's wierd because with a simple combo
box if i bind it to a table it can show multiple column and i can't
make it with code ? i just dont know how it the default combobox in
access work like i said it's not accepting my vb code, i need to find
the vba codes for it and msdn don't give a single idea how it work.

i even tried
cboMycombo.additem "test"
cboMycombo.column(0) = "test1"
cboMycombo.column(1) = "test2"

so basicly it should have created a new item, after rename the item to
test1 (first column)
and after change column2 to test2 (it was empty)

i also need a code to nuke the content of the control. the worst part
was with the listbox. the simple : lstMylist.clear doesnt work it
doesnt recognise the .clear and i dont know any other code to clear a
list

so either someone can help me found a way to populate by code 2 columns
and clear it completly for either a combobox or listbox (or any other
control that is visual) as long as it work i dont care with wich
control i can do it


From: Cindy M.
Date: Thurs, Jan 4 2007 1:35 pm


Hi Franck,

OK, try asking in a newsgroup specific for Access forms. I'm sure
there's at least one :)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)



As she suggest ill try here, i haven't seen any access.vba groups so.
Thanks
 
D

Douglas J. Steele

As it says in the Help file:

"For multiple-column lists, use semicolons to delimit the strings for each
column (for example, "1010;red;large" for a three-column list)."

As to clear, simply reset the RowSource to an empty string:

Me.lstMylist.RowSource = vbNullString
 

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