Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List Box.. Load Array as .Rowsource 1

Status
Not open for further replies.

TURNERMICH

Technical User
Apr 5, 2000
64
AU
If i fill a string with data for a list box
listit="aaaaaa";12345;"assssaas",3443434
.rowsource=listit, there seems to be a limit to the length of listit..
Have thought, maybe load data into an array, and add this to the rowsource. (will this overcomce the
limit??)
Access does not seem to have VB .additem ??
Have tried writing out table, and using this for .rowsource.... To slow.
------------------------


How do i apply an array to a list box .rowsource

ie. array name putit(100)
contents
say
Dog on Box
Cat on Roof
Pig in Pen
etc

list45.rowsource=????????????

 
Hi.

how long is listt?

maybe

lrowsource = listt & list2 & list3

would help???

Gzep.
 
Thanks for the comment.
Will give it a go tomorrow morning.
 
I have tried loading list1 & list2 etc, but it seems the .rowsource is limited to approx 2000 characters.

I have overcome the problem, by, loading only 2000 characters at a time into the list box, then having a :NEXT:
Button, and then doing the next 2000 characters.
 
The actual size of the "custom" listbox is about 2kB. You can only overcome this limit in using a table or query as rowsource.
I strongly recommend a CSV file since you can create it on the fly and it will not blow up your database file.
 
Hi!

Why don't you use the tables' data for your list box?
Create query or write SQL clause! If it isn't possibly, maybe you may make any text box or combo box for input some criterias for list box data selection before you requery it.

Private Sub Text1_Change()
'Fill a string of list box RowSource with data, with taking note of criteria (in such event you can use asterisk or/and question mark in the criteria value

StrSQL="Select .... Where ... like '" & Me.Text1.Text & "*'"
End Sub

Aivars

 
I ran into the same problem. I found a great way around this problem.
If open a standard module and select the applications references click Browse (This should open to the folder where all of your dlls and .ocxs are) Select the "Fm20.dll". When back in the References dialog box select "OK". This sets a reference to Microsoft Form 2.0 Object library. Now, back to the form, from your toolbox, select the toolbox icon with the elipse("...") to access the ActiveX controls. You will now have access to the Microsoft Forms 2.0 List box(in fact all of the MF2.0 controls). This list box (and combo box) acts like a VB List box and has the .AddItem and .RemoveItem methods. It looks and behaves a little differently than the native Access control, but it works so well and easily, that I use it whenever I need a combo or list box. It is especially useful when you are clicking one thing over from an options list box to a criteria list box. I don't think I'll ever go back.

Give it a try!

Bob
 
rbowes.
Thanks for your reply.
I will give this a go later today.

Will be nice to have .additem in access.
 
rbowes.

Have tried your method., have got to the point of having the forms.20 combo box on the screen, but, having a problem with the code.
Would appreciate a little bit of code as a demo of how to use it, if you have the time.

regards turnermich

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top