writing code to populate a list box in access

F

fvela

i am having serious troubles figuring how to add items to a list box in
access 2000, it is a no brainer for access 2002, but access 2000 is missing
the add item method for list boxes...
i using the value property or rowsource property does not work....
ie
listbox.value specifies which value is selected
and listbox.rowsource can only be set if the Rowsourcetype property is a
table/query

any ideas how i can take my access 2002 code ie. listbox.additem (..)
and make it work in access 2000...
i know i need to write a function for the method, however i have no idea how
to do so in vba... is there anyone out there who can help me??

thank you
Flav
 
M

MikeB

Private Sub Command0_Click()
ListAddItem TheNameOfMyListBox, TheStringToADD

End Sub

Private Sub ListAddItem(LB As ListBox, strItemToAdd As String)
If LB.RowSource = "" Then
LB.RowSource = IIf(LB.RowSource = "", strItemToAdd, "")
Else
LB.RowSource = LB.RowSource & ";" & strItemToAdd
End If
End Sub
 
F

fvela

I love you!!!.. thank you so much... honestly i was so frustrated with
this....
thanx again
:D
 

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

Similar Threads


Top