473,407 Members | 2,359 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,407 software developers and data experts.

A2007: Interesting list box bug

A client asked why some code behind a list box suddenly started
updating 57386 records in a table instead of the expected 38 records.
Turns out the problem is a difference in behavior between Access 2007
and previous versions of Access. The following code selects all 38
records in the list box in A2003.

For lngLoop = 0 To Me.lstUnreceivedPieces.ListCount - 1
Me.lstUnreceivedPieces.Selected(lngLoop) = True
Next lngLoop

However in Access 2007 the above code also selects the heading line.
You can visually see the difference on the list box between Access
2003 and Access 2007.

Now strictly speaking the code should've started at 1 and not 0 to
avoid selecting the heading line. But that wasn't a problem in A2003
and earlier. And I can certainly see a developer not even thinking
about this issue.

So later on his query then had the following as part of his WHERE
clause

Pieces.pID=pID OR Pieces.pID=52811 OR ...

instead of

Pieces.pID=52811 OR ...

Needless to say all 57386 records were updated.

So now we need to go into every list box in every app and double check
this behavior.

This bug has been reported to Microsoft.

Update: Ken Snell, fellow MVP couldn't recall where he got the ideo
from in the first place but the suggestion is changing the For line to
read

For lngLoop = 0 - (Me.lstUnreceivedPieces.ColumnHeads) To _
(Me.lstUnreceivedPieces.ListCount - 1)

Nice trick that.

Note that this problem happens whether the Multi Select property is
simple or complex.

Update: You can either search through all your code looking for
..selected or run the following code to open all forms with list boxes
in design view.

I didn't want to bore folks with the code so visit the blog entry if
interested in the code.
http://msmvps.com/blogs/access/archi...cess-2007.aspx

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
May 15 '07 #1
4 1776
Hi Tony,

Does the listbox included the property "Column Heads = Yes"?
I had similiar problem whenever i set to "Yes". So My code would be like..

For i = 0 To List0.ListCount - 2

I use "-2" to minus the Column Head.

The error I'm getting is "Type Mismatch" and I'm using A2K.
>Tony Toews [MVP] wrote: snip
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 15 '07 #2
"AccessVandal via AccessMonster.com" <u18947@uwewrote:
>Does the listbox included the property "Column Heads = Yes"?
Yes, the troublesome listbox is because it has the Column Heads set to yes. In
previous versions of Access Access would ignore that row. In A2007 it does not.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
May 15 '07 #3
On Tue, 15 May 2007 04:38:18 GMT, "Tony Toews [MVP]"
<tt****@telusplanet.netwrote:

It is not unusual that with subsequent versions Access has become
stricter about certain expressions. What it means to be Null, and
expressions with Null, is one example. You found another one where
MSFT decided (hopefully consciously) that it's more important to get
it right than to be backward compatible.
I for one applaud them for that.

-Tom.

>"AccessVandal via AccessMonster.com" <u18947@uwewrote:
>>Does the listbox included the property "Column Heads = Yes"?

Yes, the troublesome listbox is because it has the Column Heads set to yes. In
previous versions of Access Access would ignore that row. In A2007 it does not.

Tony
May 15 '07 #4
Tom van Stiphout <no*************@cox.netwrote:
>It is not unusual that with subsequent versions Access has become
stricter about certain expressions. What it means to be Null, and
expressions with Null, is one example. You found another one where
MSFT decided (hopefully consciously) that it's more important to get
it right than to be backward compatible.
I for one applaud them for that.
Umm, yeah, you could argue that one both ways.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
May 15 '07 #5

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

Similar topics

1
by: Allen Browne | last post by:
In Access 2007, you can select multiple items in the Navigation Pane, via Shift+Click, Ctrl+Click, Shift+arrow keys, etc. You can also Shift+Del an object to delete it without confirmation (just...
1
by: Karl | last post by:
I have a simple tool bar used for reports. It shows at the top of previewed reports and allows the user to print the report or close the view. The close part of the tool bar doesn't work in A2007....
3
by: Tom van Stiphout | last post by:
I posted two issues in microsoft.public.access.adp.sqlserver. For those of you who have tried to deploy an ADP with the A2007 runtime, or who are otherwise interested, I would appreciate very much...
6
by: Wayne | last post by:
I have an Access 2003 database that has several reports with charts on them that all work fine under A2003. All but one works fine under Access 2007. On this particular chart the chart columns...
1
by: Wayne | last post by:
I've searched this forum and trawled the wider web and can't find any information on how to hide or disable the A2007 Quick Access Toolbar. The toolbar is not something that one wants available to...
2
by: Wayne | last post by:
I've noticed a behaviour in A2007 that doesn't appear in A2003. The problem is appearing in a native A2007 database and an A2003 database running in A2007. If I press a command button to delete a...
4
by: Wayne | last post by:
I am putting together an A2007 database using Windows Vista. I noticed that when I roll my mouse cursor onto and off a command button the command button gives a flicker. To ensure that the...
2
by: Wayne | last post by:
When entering data into a continuous form in A2003, if I click the "New Record" button on the navigation bar, the form scrolls and places the new record at the top of the details section ready for...
6
by: Randy Shore | last post by:
I have a shared Access mdb that was originally written in A2000. The database is large, around 40 tables, 40 forms (many with multiple sub-forms), and 100s of reports. The database is not split,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.