Jumat, 20 Januari 2017

Re: [MS_AccessPros] string functions

 

Phucon-


Is there always a "-" in the next-to-last character?  If so, you could write a function to find the "-" and return a string that handles the different lengths correctly.

Let me know, and I will try to help you with the function.

John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals 
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
(Paris, France)




On Jan 20, 2017, at 8:59 PM, saigonf7q5@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:





I use a series of string functions (see below) to change the look of a column of data from this " 1234567-8" to this "1-2-3-4-5-6-7-8"

 


Left([PrtNum],1)+"-" & Mid([PrtNum],2,1)+"-" & Mid([PrtNum],3,1)+"-" & Mid([PrtNum],4,1)+"-" & Mid([PrtNum],5,1)+"-" & Mid([PrtNum],6,1)+"-" & Right([PrtNum],1) & Right([PrtNum],2)

 


It works so far. What if the number of digits of the rows are not the same? e.g.  some rows are 8 digits, some are 5, 6 or 7.  What is the better or smart way to solve this problem?

 


Thank you

 


Phucon




__._,_.___

Posted by: John Viescas <johnv@msn.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (2)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

Tidak ada komentar:

Posting Komentar