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.
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.