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

Home Posts Topics Members FAQ

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.lstUnreceive dPieces.ListCou nt - 1
Me.lstUnreceive dPieces.Selecte d(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=5281 1 OR ...

instead of

Pieces.pID=5281 1 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.lstUnreceiv edPieces.Column Heads) To _
(Me.lstUnreceiv edPieces.ListCo unt - 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 1792
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.c om
http://www.accessmonster.com/Uwe/For...ccess/200705/1

May 15 '07 #2
"AccessVand al via AccessMonster.c om" <u18947@uwewrot e:
>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****@teluspl anet.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.

>"AccessVanda l via AccessMonster.c om" <u18947@uwewrot e:
>>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
1943
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 like the Database window in previous versions.) *But*, when you Shift+Del, A2007 misinterprets the held-down Shift and selects *all* previous objects in the list. Does that sound dangerous to you? If you Shift+Del the last form, and slip
1
1353
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. The print icon does work. This is an A2000 mde file Is there a change I can make so that the close button will work when using A2007?.
3
2180
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 if you would take a look at them. -Tom.
6
2074
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 extend out to the right of the chart container all the way to the edge of the report page. I know that Access 2007 has lots of bugs. Has anyone seen anything like this?
1
4875
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 the user in a custom application. Can it be disabled or hidden and if so, how?
2
4404
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 record on a single form using DoCmd.RunCommand acCmdDeleteRecord as the code behind the button, when I close that form Access asks me if I want to save the changes to the form. This only happens if the database is an mdb or accdb. If it has...
4
1574
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 problem was not related to this particular database I have done the following: Created a new A2007 database with one plain form i.e no background colors etc. Made the form header and footer visible. Placed 3 command buttons on the form, one in the...
2
1583
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 data entry. The data can then be entered in the usual manner. If I open the same database in A2007, the above happens, but as soon as I start to enter data in a field the form scrolls again and places the new record at the bottom of the...
6
2151
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, but runs off of the LAN in the office with about 5 or 6 concurrent users. Recently the office upgraded to A2007 but they are continuing to run in compatability mode. The problem is that with ordinary use, read/write operations through the...
0
9715
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
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
10356
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
10099
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...
0
9176
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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();...
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.