473,395 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to limit records displayed in ListBox?

Is there any way to limit the number of records loaded into a ListBox?

I looked at qdf.MaxRecords (to apply to the query that is the RowSource of
the ListBox) but that only applies to ODBC data sources. I also looked at
Tools > Options > Edit/Find and tried setting the "Don't display lists where
more than this number of records read:" property, but that doesn't help.

The List Box in question is supposed to allow scrolling/browsing of all
records in the database, but that gets to be a problem with tens of
thousands of records.

There are a number of options the user has to sort/filter/narrow the list to
find whatever is being searched for, so I'd like to limit the list to
something around 10,000 which would encourage the user to use the those
other features. Can this be done? Do I have to use something like SELECT
TOP 10000 [records] FROM tblData?
Nov 13 '05 #1
3 6617
The option on the Edit/Find tab is for the combo boxes when you go to
"filter by form".

One option, as you mentioned, would be to use a TOP query. Another option
would be to assign the row source to the list box via code. You could do a
count of the records returned in the code prior to assigning the query to
the row source. If the count is too great, popup a message to the user
telling them that too many records have been returned and to refine their
search. If the count is within reason, assign the query to the row source.

I think I remember reading that there is an option you can set in the
listbox or combo box when using an adp file to connect to SQL Server or
MSDE.

--
Wayne Morgan
MS Access MVP
"deko" <de**@nospam.com> wrote in message
news:HP********************@comcast.com...
Is there any way to limit the number of records loaded into a ListBox?

I looked at qdf.MaxRecords (to apply to the query that is the RowSource of
the ListBox) but that only applies to ODBC data sources. I also looked at
Tools > Options > Edit/Find and tried setting the "Don't display lists
where more than this number of records read:" property, but that doesn't
help.

The List Box in question is supposed to allow scrolling/browsing of all
records in the database, but that gets to be a problem with tens of
thousands of records.

There are a number of options the user has to sort/filter/narrow the list
to find whatever is being searched for, so I'd like to limit the list to
something around 10,000 which would encourage the user to use the those
other features. Can this be done? Do I have to use something like SELECT
TOP 10000 [records] FROM tblData?

Nov 13 '05 #2
> One option, as you mentioned, would be to use a TOP query. Another option
would be to assign the row source to the list box via code. You could do a
count of the records returned in the code prior to assigning the query to
the row source. If the count is too great, popup a message to the user
telling them that too many records have been returned and to refine their
search. If the count is within reason, assign the query to the row source.

I think I remember reading that there is an option you can set in the
listbox or combo box when using an adp file to connect to SQL Server or
MSDE.


TOP it is. In the Preferences Form of the app I let the user set the limit.
Of course I now have to dynamically build the SQL string and assign it the
query used for the RowSource. What I don't like about TOP is that it
returns records with lower autonumbered PKs first. So instead of returning
the most recent 10000 records entered, it returns the oldest 10000. I could
use ORDER BY to reverse this, but that slows down the query to the point
where it negates any speed increase gained by the lower record count.
Nov 13 '05 #3
On Mon, 22 Aug 2005 20:13:41 -0700, "deko" <de**@nospam.com> wrote:

In my mind if you do Top, you must also do OrderBy.
Not doing so, would typically return the records in PK order, but if I
understand SQL correctly, that is NOT a guarantee. I would gladly
sacrifice some performance for predictability.

OrderBy is not slow if issued on an indexed column.

-Tom.

One option, as you mentioned, would be to use a TOP query. Another option
would be to assign the row source to the list box via code. You could do a
count of the records returned in the code prior to assigning the query to
the row source. If the count is too great, popup a message to the user
telling them that too many records have been returned and to refine their
search. If the count is within reason, assign the query to the row source.

I think I remember reading that there is an option you can set in the
listbox or combo box when using an adp file to connect to SQL Server or
MSDE.


TOP it is. In the Preferences Form of the app I let the user set the limit.
Of course I now have to dynamically build the SQL string and assign it the
query used for the RowSource. What I don't like about TOP is that it
returns records with lower autonumbered PKs first. So instead of returning
the most recent 10000 records entered, it returns the oldest 10000. I could
use ORDER BY to reverse this, but that slows down the query to the point
where it negates any speed increase gained by the lower record count.


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: middletree | last post by:
Yesterday, I posted a question which ended up giving me a lot of info, but the core question never got answered/solved. The short version is that when a page displays a number of records based on...
6
by: JohnH | last post by:
I have an ASP app (developed with Interdev 6) which uses a DTC listbox (server-side) bound to a recordset to allow the user to make a selection. This works fine until the number of records in the...
2
by: Danny | last post by:
How to allow users to select a set of records and then let them change a field for all these records at once? I would like to do this in code on a form. I will have a form with tabular view of...
3
by: DD | last post by:
I have a mainform with a subform. > The main form has a dropdown box "chooseMonth", in the afterupdate event > i requery the subform so all records with the same date are viewed. > Now i only want...
3
by: rodchar | last post by:
hey all, is there a way to limit the number of records in a dropdown and have scroll bars to see the rest of the records? thanks, rodchar
3
by: superjacent | last post by:
Hope someone can help. I have a listbox displaying time periods in blocks of 15 mins for a 24 hour period, all up 96 rows. The listbox can only visibly show 20 rows a time. The default...
2
by: claudia.carlotti | last post by:
Anyone knows how to avoid the limit to 36000 records that access has with a combo box? Any help will be appreciated. Many Thanks... Claudia
6
by: gerbski | last post by:
Hi all, I am relatively new to ADO, but up to now I got things working the way I wanted. But now I've run into somethng really annoying. I am working in MS Access. I am using an Access...
10
by: suzanne099 | last post by:
Hello, I am trying to use a list box based on a large query of records within an access form. The query contains 95,738 records, but the list box only lists 65,536. Is there a default limit...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.