473,386 Members | 1,785 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,386 software developers and data experts.

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.SetFocus
DoCmd.FindRecord Me.lstEmployers.Value

MsgBox Me.lstPersons.ListCount
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 1692

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

Similar topics

2
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...
9
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...
2
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...
24
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...
1
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:...
2
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...
5
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...
4
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? ...
12
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...
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...

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.