Hello,
I have a report that returns document numbers in the format "AA999999". These numbers are not in alphabetical and then numerical order. How can I put these in order?
Thanks,
Charlie
10 2150
Hi Charlie. Create a query that sorts the data in the order you want. Then set the Record Source of the Report to be the query, instead of the table.
Amy
Are you trying to get the alpha part in text order and the numeric part in number order ?
If you want the fields in alpha then numeric order you can do it in a query. To test this I created a table "Table1" with one text field "Testdata" where I put the data in the form
XXXnnnnnn where the alpha part was 3 characters and the numeric could be any length. the following SQL query orders the data in alpha then numeric order
select left(testdata,3) as Al,right(testdata,len(testdata)-3) as nu from Table1 order by left(testdata,3),right(testdata,len(testdata)-3)
... - select left(testdata,3) as Al,right(testdata,len(testdata)-3) as nu
-
from Table1
-
order by left(testdata,3),right(testdata,len(testdata)-3)
Hi.
I'm curious. In this kind of SQL statement, could you instead say order by Al, nu?
Hi.
I'm curious. In this kind of SQL statement, could you instead say order by Al, nu?
No, I tried that & got an error. I think it is because the SQL compiler evaluates the order by clause before it allocates field aliases.
No, I tried that & got an error. I think it is because the SQL compiler evaluates the order by clause before it allocates field aliases.
Sounds reasonable.
NeoPa 32,556
Expert Mod 16PB
Hi,
I hope I'm not missing the point here, but try going to the design of the report and clicking on 'Sorting and Grouping'. When the popup comes up, add the 'Document Number' field in as the main (only?) sort field.
You won't need to enable Group Headers or Footers.
Great. I thank you all for your help. My report looks great now.
Charlie
Hi,
I hope I'm not missing the point here, but try going to the design of the report and clicking on 'Sorting and Grouping'. When the popup comes up, add the 'Document Number' field in as the main (only?) sort field.
You won't need to enable Group Headers or Footers.
The issue is that when mixed alphanumeric fields are sorted they are sorted in srtict alpha order hece a field containing
a123
a20
a300
a5
a10000
will sort as
a1000
a123
a20
a300
a5
when what you really want is
a5
a20
a123
a300
a10000
ie the number part sorted in numeric sequence
NeoPa 32,556
Expert Mod 16PB
I have a report that returns document numbers in the format "AA999999". These numbers are not in alphabetical and then numerical order. How can I put these in order?
But, from the original post, we know that the layout is fixed length.
So, while you make a very valid point, it doesn't pertain here.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: EMiller |
last post by:
Hello,
I am encountering a development challenge here that seems
to be stumping me.
I am developing a C#/.NET application using an MSDE
database. There is a particular field in a table that I...
|
by: Rich N |
last post by:
When I open my form, I want the records already in it to be in
Ascending Order based on one field. Though I keep putting them in
Ascending order and then saving the form, each time I re-open the...
|
by: Helgardh |
last post by:
I have a linked table (Access 2003) to an Outlook inbox. The body of
the e-mail messages are in a memo field. My problem is that I need to
"read" the memo and find data on certain lines.
The...
|
by: James Norton-Jones |
last post by:
Hi,
Am I trying to hold the data of a DataGrid in a label so that when the form
is reposted the DataGrid can be repopulated. The problem I am having is that
I don't understand how to get the...
|
by: MR |
last post by:
I get the following Exception "The data at the root level is invalid. Line
1, position 642" whenever I try to deserialize an incoming SOAP message. The
incoming message is formed well and its...
|
by: mattdfong |
last post by:
I am using mysql to receive stock market rate data, and I have a rate
feed which tells me when the rate has changed. I input the data as it
comes in, into a mysql database that has both a...
|
by: Danzak |
last post by:
Can anyone out there help me with a problem I’m having?
I have a database with 10117 records in it. Each record is numbered from 0001NHP to 10117NHP. Sometimes I have the database in alphabetical...
|
by: drawing in aspnet |
last post by:
Question about putting the data layer in a separate class library.
I keep reading that the data layer should be separated from the
presentation layer and put in its own class library. I am...
|
by: ck123456 |
last post by:
hi all
regarding my previous post of having a code like this g.DrawString(Input1.Text(n), big_font, Brushes.Black, x , y , and putting it in a listbox
actually i am taking a data from a textbox and...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
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...
|
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...
| |