Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sort by last five digits in query field

Posted on 2013-01-06
2
Medium Priority
?
591 Views
Last Modified: 2013-01-07
MS Access 2007: i have a table I'm querying from a exported xls file that has a nasty field with the city,state (2 digit) and the zip code all combined. I need to sort on the zip code which is the last five digits of the field but in some cases, there is no zip code in some of the records. If it helps any, all of the records use the 2 digit state of Tx followed by the five digit zip code (for example: Dallas,Tx 12345), if available. I need to do this in the query or the applicable report which I derive from this query.
0
Comment
Question by:howcheat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
etech0 earned 2000 total points
ID: 38749646
Add another field to the query, like this:

zip: Right([FieldContainingCityStateZip],5)

In the criteria row, put this:

<"a"

That will filter it so you only see the numeric ones.

Then, sort that field. You can uncheck Show if you don't want to see it.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38749657
add another column to your query with something like this

right([NameOfField],5)


ascending


-------------------------

to handle the records with no zip code, you can do this

iif(isnumeric(right([nameofField],5)), right([nameofField],5),"99999")
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question