Access 2016 Query with Proper Case logic

E C
E C used Ask the Experts™
on
I am using Access 2016 to import a CSV file, format the data and then export a new CSV.

(The exported CSV must have data in specific columns and specific formats, so that it can be uploaded to the back end of a web app)

Some of the formatting is easy. For example, the web app requires a field called "Address3" to be in column 9.
The data that I am importing will never have an Address 3 field, so in my select query in Access, I just use this expression:
     "" AS Address3

To make sure there are no leading/trailing spaces in my records, I can do something like this:
    Trim(LocationList.City) AS City

The Address fields (Address 1, Address 2 and City) in the source file are always UPPER CASE.
But I need them to be proper case. So I use this expressing in my Access Select Query:
        StrConv(LocationList.Address1,3) AS Address1

This works great, except some parts of the address should NOT be converted to Proper Case.

An example:
    1234 MAIN STREET SW
should be converted to
    1234 Main Street SW  (Not "Sw")

There are a finite number of combinations that should remain in all caps - mainly the directional abbreviations:  NE, SE, SW, NW and perhaps a few more.

Is it possible to write a select Query in Access that does this:
    Convert this field to Proper Case, but leave "NE", "SE", "SW" and "NW" capitalized
And to make it more complicated, only apply this when these combinations of letters stand alone. In other words, either a space before and after or a space before and end of line after, or beginning of line before and a space after.  In other words, "NEWTON" should still convert to "Newton", not "NEwton"

Or maybe a Select Query is not the right place to do this. Maybe when I run the query, it can trigger some code that iterates through each word in the field, and then the information is displayed?

The entire purpose of this Access database is to transform the source data into a specific format, so that it can be exported as a new csv file and uploaded to a different (third party) web application.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
try this

Replace(Replace(Replace(Replace(StrConv(Address1, 3) & " ", " Sw ", " SW"), " Se ", " SE"), " Nw ", " NW"), " Ne ", " NE")

Author

Commented:
I just made one slight modification - I added a blank space after the string. But other than that it worked. Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial