473,796 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6648
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.co m> wrote in message
news:HP******** ************@co mcast.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.co m> 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
2431
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 some criteria that the user selects, the last record shows up in the source code, but not in the display. Specifically, I can see 25 records (actually nested tables built with some loop code) More playing around showed me that adding one more...
6
5793
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 record set seems to hit a limit (not determined the exact limit, but seems to be c. 400). If there are too many records, the app just hangs until it hits the scripttimeout limit. I've tried increasing both the command timout (I'm using an ADO...
2
453
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 records, and I guess they will select more than one record with the SHIFT key, then they can modify a whole bunch of records at once. Thanks
3
2673
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 to print the selected records of the selected month > Can any one advise on the below Below is code i am trying to adapt (Thanks Don) 1.This first part is causing me problems so i have deleted it as it strikes me that it is looking for a...
3
1299
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
14466
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 feature is that the first row is at the top of the listbox.
2
1653
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
2778
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 frontend separately from a backend. The tables from the backend database are linked in the frontend database. In the frontend there is a Form with a listbox in it. The listbox rowsource is a query that selects all the records from a (linked)
10
15697
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 on the number of records shown in an access list box? If so, is there anyway to change this default to allow all the query records to be access via the list box? Thanks. Suzanne
0
9673
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9525
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10221
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10169
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.