473,804 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ListCount bug with column heads

Access 2002 on Win98 at least, not tested elsewhere:

Bug: The ListCount property of an unbound listbox may be incorrect if you
use column heads.

Model: Set up a simple database with two simple tables (I used employer and
person). Create a bound form based on the employer table, with a txtName
textbox, a txtID textbox, and an unbound listbox to the employer table
["SELECT * FROM employer"]. Add a second unbound listbox for the person
table, with column heads ["SELECT * FROM person"]. Then add at least one
employer to the employer table.

Add a Find button with the following code:

Private Sub btnFind_Click()
Me.txtID.SetFoc us
DoCmd.FindRecor d Me.lstEmployers .Value

MsgBox Me.lstPersons.L istCount
End Sub

Open the form, and select the employer in the employer listbox. Hit the Find
button. The first time, the MsgBox will incorrectly report the ListCount as
0. According to Help, it should show "1", since it is a Listbox based on a
Query with column heads. Further, after pressing the Find button several
times (3- 10 or so, depending on how fast you press the button!), the
MsgBox will begin to correctly report "1".

Damn irritating if you've been relying on the ListCount property.

Darryl Kerkeslager

Nov 12 '05 #1
0 1710

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

Similar topics

2
1782
by: John | last post by:
Hi I have this funny problem with the listcount property of a list control. If there is no item in the list, Me.stafflist.ListCount returns 0 (zero). If there are any items then Me.stafflist.ListCount returns the actual number of items + 1. Why is that? Thanks Regards
9
1703
by: Domel | last post by:
1 Jak zaokrąglić float'a tak żeby jeżeli część dziesiętna była większa lub równa od 0.5 to był on zaokrąglany w górę, jeżeli mniejsza to w dół np 1.6 po zaokr 2.0 1.2 po zaokr 1 prosiłbym o ile to możliwe o jakieś sposoby bez dołączania bibliotek, przy użyciu jakichś operacji 2. dla czego jeżeli wykonuję poniższą operację
2
2124
by: Lennart Nielsen | last post by:
I'm trying to use the FileListBox, but it does not seem to have the ListCount property or any substitute. Any bids on this or another way (short of the old DOS routine) to get a countable listing or array of files from a folder? Lennart
24
19975
by: Mike Otten | last post by:
Any help greatly appreciated. The validated page is at: http://myweb.stedwards.edu/michaelo/ddtab.htm The trouble is with the radio buttons (2/3-down the left column). The radios are displaying a line above their respective labels. Here are the html and css snippets: <fieldset class="radio"> <legend>Credit card</legend>
1
8465
by: andrew.panin | last post by:
Hi there! I've got a trouble with these things. What's going on? 1ST STEP: we have ListBox item. Let's call it ListBox1. We're adding four values to it using AddItem method: ListBox1.AddItem('a') ListBox1.AddItem('b') ListBox1.AddItem('c') ListBox1.AddItem('d')
2
7576
by: Bruce | last post by:
This is baffling to me. I'm using Access 2002. If I create an unbound form and put an unbound listbox on it (List0) and then add the following code to the Form_Load event: Private Sub Form_Load() List0.ColumnHeads = False Set List0.Recordset = Nothing MsgBox List0.ListCount
5
3512
by: eleksoft | last post by:
My code: If List.Listcount > 0 then For intI = 0 to List.Listcount - 1 'code Next intI End If For some reason, and not all the time, this loop only runs to the second last entry. I have even witnessed it in break mode and following it step by step with Shift + F8, where it reports - for example - that the listcount is 14, when if fact it is 15 and has index values of 0 to 14. I made a quick fix, but I don't like...
4
18661
JAMBAI
by: JAMBAI | last post by:
I have 200,000 records in database which needs to be listed in the combobox list but, when Check for combobox.ListCount it gives only the top 65,000 Is there a maximum of item in VBA ComboBox? Thanks Jambai
12
2196
by: Yofnik | last post by:
Hello All, If this is not the appropriate group for this post, please point me in the right direction. I am trying to create a layout that has three main columns. The primary content is the left most column. The width of this should be variable depending on the size of the browser window. The middle and right columns should have a fixed width of 200 pixels. I can get the middle and right columns working as expected. I can't figure out...
0
9595
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
10603
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...
1
7643
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...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
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
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
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.