Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"The medium is the message." -- Marshall McLuhan


devel / comp.databases.ms-access / Re: Strange behaviour when sorting

SubjectAuthor
* Strange behaviour when sortingKeith Tizzard
`* Strange behaviour when sortingRon Weiner
 `* Strange behaviour when sortingKeith Tizzard
  `- Strange behaviour when sortingKeith Tizzard

1
Strange behaviour when sorting

<4486e606-9896-4182-9fca-611d097ebaccn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=844&group=comp.databases.ms-access#844

  copy link   Newsgroups: comp.databases.ms-access
X-Received: by 2002:a05:620a:4411:b0:6a7:6030:f9d1 with SMTP id v17-20020a05620a441100b006a76030f9d1mr712019qkp.14.1655138237572;
Mon, 13 Jun 2022 09:37:17 -0700 (PDT)
X-Received: by 2002:a05:6871:93:b0:fe:23b6:6efb with SMTP id
u19-20020a056871009300b000fe23b66efbmr325038oaa.201.1655138237213; Mon, 13
Jun 2022 09:37:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.databases.ms-access
Date: Mon, 13 Jun 2022 09:37:16 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=92.4.218.77; posting-account=SKIztwgAAAD15rYh-v-27VVmHult5LKY
NNTP-Posting-Host: 92.4.218.77
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4486e606-9896-4182-9fca-611d097ebaccn@googlegroups.com>
Subject: Strange behaviour when sorting
From: internet.shopping@foobox.com (Keith Tizzard)
Injection-Date: Mon, 13 Jun 2022 16:37:17 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1416
 by: Keith Tizzard - Mon, 13 Jun 2022 16:37 UTC

I have query for a dropdown:
Select CustID, AccountName from Customers

which displays 50884 records

If I sort it:
Select CustID, AccountName from Customers
Order by AccountName

it only displays 12984

and sorting the other way
Select CustID, AccountName from Customers
Order by AccountName Desc

displays the other 37900

Has anyone else come across this strange behaviour? and why does it happen?

Re: Strange behaviour when sorting

<t88764$rh2$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=845&group=comp.databases.ms-access#845

  copy link   Newsgroups: comp.databases.ms-access
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: rw@domain.com (Ron Weiner)
Newsgroups: comp.databases.ms-access
Subject: Re: Strange behaviour when sorting
Date: Mon, 13 Jun 2022 16:37:21 -0400
Organization: WorksRite
Lines: 44
Message-ID: <t88764$rh2$1@dont-email.me>
References: <4486e606-9896-4182-9fca-611d097ebaccn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 13 Jun 2022 20:37:24 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="a93d2b7a288ab7902e740982bab64eea";
logging-data="28194"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mq9suveoktv9kFoY6n5Nz"
Cancel-Lock: sha1:Mllv4xnczpJlJcv2yRTYFTt83hA=
X-Antivirus-Status: Clean
X-Newsreader: MesNews/1.08.06.00-gb
X-Antivirus: AVG (VPS 220613-4, 6/13/2022), Outbound message
X-ICQ: 1701145376
 by: Ron Weiner - Mon, 13 Jun 2022 20:37 UTC

Keith Tizzard formulated the question :
> I have query for a dropdown:
> Select CustID, AccountName from Customers
>
> which displays 50884 records
>
> If I sort it:
> Select CustID, AccountName from Customers
> Order by AccountName
>
> it only displays 12984
>
> and sorting the other way
> Select CustID, AccountName from Customers
> Order by AccountName Desc
>
> displays the other 37900
>
> Has anyone else come across this strange behaviour? and why does it happen?

WOW, that is an awful lot of rows for a Combo Box. You might want to
consider another method to whittle down the number of rows you fetch
from the table before populating your Combo, List, etc. Typically when
I have a situation like yours I use a Text Box and a List box in
combination. When the form is opened both controls are empty and as
the user starts typing text into the Text Box I re-query the list's row
source using the fragment of text that they typed. Air code below:

Private Sub txtSearch_Change()
Dim strSql As String

strSql = "Select CustID, AccountName from Customers " _
& "Where LastName like '*" _
& Replace(Nz(txtSearch.Value, ""), "'", "''") " _
& "ORDER BY AccountName;"
lstSearch.RowSource = strSql

End Sub

You might want to consider adding some option buttons to allow the
user to customize the sorting, and perhaps forcing the user to type in
two or three characters before changing the Row Source. Just my $.02

Rdub

Re: Strange behaviour when sorting

<e04ce9e6-00f5-4d07-94f2-90c09ec4e4efn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=846&group=comp.databases.ms-access#846

  copy link   Newsgroups: comp.databases.ms-access
X-Received: by 2002:ac8:5e08:0:b0:305:1175:53e9 with SMTP id h8-20020ac85e08000000b00305117553e9mr3823862qtx.557.1655212553409;
Tue, 14 Jun 2022 06:15:53 -0700 (PDT)
X-Received: by 2002:a05:6808:1888:b0:32e:ff9e:cd31 with SMTP id
bi8-20020a056808188800b0032eff9ecd31mr2072726oib.286.1655212553158; Tue, 14
Jun 2022 06:15:53 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.databases.ms-access
Date: Tue, 14 Jun 2022 06:15:52 -0700 (PDT)
In-Reply-To: <t88764$rh2$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=92.4.218.77; posting-account=SKIztwgAAAD15rYh-v-27VVmHult5LKY
NNTP-Posting-Host: 92.4.218.77
References: <4486e606-9896-4182-9fca-611d097ebaccn@googlegroups.com> <t88764$rh2$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e04ce9e6-00f5-4d07-94f2-90c09ec4e4efn@googlegroups.com>
Subject: Re: Strange behaviour when sorting
From: internet.shopping@foobox.com (Keith Tizzard)
Injection-Date: Tue, 14 Jun 2022 13:15:53 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Keith Tizzard - Tue, 14 Jun 2022 13:15 UTC

I agree that there are many records. I had not realised that. How tables grow over 20 years of use.

However this is not the problem. Nor is it to do with the SQL being used for a dropdown. The problem lies in the query itself.

This has been working perfectly well for 20 years until just the other day. I thought that either an update in Access or some new data could be the problem.

After much experimenting I suspect there must be something in the data but cannot find what it is. If I add an arbitrary condition on another field in the table that excludes no records the sorting works correctly E.g.

SELECT CustomerID, AccountName
FROM Customers
WHERE AccountStatus Is Not Null
ORDER BY AccountName;

The field AccountStatus always has a non null value.

A complete mystery!!

I exported the table to a new database in which it is the only table. And everything works!!

I therefore suspect some data error and will later Compact and Repair the database to see if that resolves it.

Jim
On Monday, 13 June 2022 at 21:37:29 UTC+1, Ron Weiner wrote:
> Keith Tizzard formulated the question :
> > I have query for a dropdown:
> > Select CustID, AccountName from Customers
> >
> > which displays 50884 records
> >
> > If I sort it:
> > Select CustID, AccountName from Customers
> > Order by AccountName
> >
> > it only displays 12984
> >
> > and sorting the other way
> > Select CustID, AccountName from Customers
> > Order by AccountName Desc
> >
> > displays the other 37900
> >
> > Has anyone else come across this strange behaviour? and why does it happen?
> WOW, that is an awful lot of rows for a Combo Box. You might want to
> consider another method to whittle down the number of rows you fetch
> from the table before populating your Combo, List, etc. Typically when
> I have a situation like yours I use a Text Box and a List box in
> combination. When the form is opened both controls are empty and as
> the user starts typing text into the Text Box I re-query the list's row
> source using the fragment of text that they typed. Air code below:
>
> Private Sub txtSearch_Change()
> Dim strSql As String
>
> strSql = "Select CustID, AccountName from Customers " _
> & "Where LastName like '*" _
> & Replace(Nz(txtSearch.Value, ""), "'", "''") " _
> & "ORDER BY AccountName;"
> lstSearch.RowSource = strSql
>
> End Sub
>
> You might want to consider adding some option buttons to allow the
> user to customize the sorting, and perhaps forcing the user to type in
> two or three characters before changing the Row Source. Just my $.02
>
> Rdub

Re: Strange behaviour when sorting

<b7497db7-93c3-4e62-b93b-c8a739241943n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=847&group=comp.databases.ms-access#847

  copy link   Newsgroups: comp.databases.ms-access
X-Received: by 2002:ac8:5bd1:0:b0:304:efba:972d with SMTP id b17-20020ac85bd1000000b00304efba972dmr8825581qtb.635.1655302168958;
Wed, 15 Jun 2022 07:09:28 -0700 (PDT)
X-Received: by 2002:a05:6870:e256:b0:f3:3165:6741 with SMTP id
d22-20020a056870e25600b000f331656741mr5746950oac.60.1655302168740; Wed, 15
Jun 2022 07:09:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.databases.ms-access
Date: Wed, 15 Jun 2022 07:09:28 -0700 (PDT)
In-Reply-To: <e04ce9e6-00f5-4d07-94f2-90c09ec4e4efn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=92.4.218.77; posting-account=SKIztwgAAAD15rYh-v-27VVmHult5LKY
NNTP-Posting-Host: 92.4.218.77
References: <4486e606-9896-4182-9fca-611d097ebaccn@googlegroups.com>
<t88764$rh2$1@dont-email.me> <e04ce9e6-00f5-4d07-94f2-90c09ec4e4efn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b7497db7-93c3-4e62-b93b-c8a739241943n@googlegroups.com>
Subject: Re: Strange behaviour when sorting
From: internet.shopping@foobox.com (Keith Tizzard)
Injection-Date: Wed, 15 Jun 2022 14:09:28 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4206
 by: Keith Tizzard - Wed, 15 Jun 2022 14:09 UTC

Just to conclude, a Compact and Repair did the trick. I assume that an index had become corrupted

On Tuesday, 14 June 2022 at 14:15:55 UTC+1, Keith Tizzard wrote:
> I agree that there are many records. I had not realised that. How tables grow over 20 years of use.
>
> However this is not the problem. Nor is it to do with the SQL being used for a dropdown. The problem lies in the query itself.
>
> This has been working perfectly well for 20 years until just the other day. I thought that either an update in Access or some new data could be the problem.
>
> After much experimenting I suspect there must be something in the data but cannot find what it is. If I add an arbitrary condition on another field in the table that excludes no records the sorting works correctly E.g.
>
> SELECT CustomerID, AccountName
> FROM Customers
> WHERE AccountStatus Is Not Null
> ORDER BY AccountName;
>
> The field AccountStatus always has a non null value.
>
> A complete mystery!!
>
> I exported the table to a new database in which it is the only table. And everything works!!
>
> I therefore suspect some data error and will later Compact and Repair the database to see if that resolves it.
>
> Jim
> On Monday, 13 June 2022 at 21:37:29 UTC+1, Ron Weiner wrote:
> > Keith Tizzard formulated the question :
> > > I have query for a dropdown:
> > > Select CustID, AccountName from Customers
> > >
> > > which displays 50884 records
> > >
> > > If I sort it:
> > > Select CustID, AccountName from Customers
> > > Order by AccountName
> > >
> > > it only displays 12984
> > >
> > > and sorting the other way
> > > Select CustID, AccountName from Customers
> > > Order by AccountName Desc
> > >
> > > displays the other 37900
> > >
> > > Has anyone else come across this strange behaviour? and why does it happen?
> > WOW, that is an awful lot of rows for a Combo Box. You might want to
> > consider another method to whittle down the number of rows you fetch
> > from the table before populating your Combo, List, etc. Typically when
> > I have a situation like yours I use a Text Box and a List box in
> > combination. When the form is opened both controls are empty and as
> > the user starts typing text into the Text Box I re-query the list's row
> > source using the fragment of text that they typed. Air code below:
> >
> > Private Sub txtSearch_Change()
> > Dim strSql As String
> >
> > strSql = "Select CustID, AccountName from Customers " _
> > & "Where LastName like '*" _
> > & Replace(Nz(txtSearch.Value, ""), "'", "''") " _
> > & "ORDER BY AccountName;"
> > lstSearch.RowSource = strSql
> >
> > End Sub
> >
> > You might want to consider adding some option buttons to allow the
> > user to customize the sorting, and perhaps forcing the user to type in
> > two or three characters before changing the Row Source. Just my $.02
> >
> > Rdub

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor