Answered by:
How to use Input Masks for IBAN up to 34 characters?

Question
-
I have to use input masks for IBAN field in the CompanyAccounts table.
I tried to set input masks for IBAN number; however, input masks support for 32 characters.
Whereas, IBAN number consists up to 34 alphanumeric characters.
Can anyone advise me how to use input masks for IBAN field?
Monday, October 31, 2016 5:43 PM
Answers
-
I think this will do it for you;
Public Function Format_IBAN(varIn As Variant) As Variant Dim varOut As Variant Dim varBuild As Variant Dim x As Integer Dim y As Integer If IsNull(varIn) = True Then Exit Function varBuild = UCase(varIn) x = Len(varIn) varOut = Mid(varBuild, 1, 4) For y = 5 To x Step 4 varOut = varOut & " " & Mid(varBuild, y, 4) Next Format_IBAN = varOut End Function
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_Professionals- Marked as answer by Khurram Ahmed Khan Monday, October 31, 2016 8:57 PM
Monday, October 31, 2016 8:25 PM
All replies
-
How can you set up an input mask when each country has its own formatting? See IBAN formatting This article also states the account is up to 30 characters long, not 34.
From what I can tell, you will have to handle this with VBA code, first checking the country of origin and then separating the string into groups of 4 characters with the last group being variable in length
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsMonday, October 31, 2016 6:47 PM -
Thanks for your reply Bill,
Yes, I read that article. The Basic Account Number is up to 30 characters, whereas IBAN consists up to 34 characters.
Actually, I want to show IBAN on the report into groups of 4 characters. So that, it can be readable easily.
Instead, of checking country of origin, I would prefer to break it into groups of 4 characters.
I think it can be done by using Mid Function.
Monday, October 31, 2016 7:12 PM -
I think this will do it for you;
Public Function Format_IBAN(varIn As Variant) As Variant Dim varOut As Variant Dim varBuild As Variant Dim x As Integer Dim y As Integer If IsNull(varIn) = True Then Exit Function varBuild = UCase(varIn) x = Len(varIn) varOut = Mid(varBuild, 1, 4) For y = 5 To x Step 4 varOut = varOut & " " & Mid(varBuild, y, 4) Next Format_IBAN = varOut End Function
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_Professionals- Marked as answer by Khurram Ahmed Khan Monday, October 31, 2016 8:57 PM
Monday, October 31, 2016 8:25 PM -
Thanks Bill,
I have tested your function in query design and it's working perfectly.
Thanks a lot for your help.
Monday, October 31, 2016 8:57 PM -
You're welcome. Happy to help.
Bill Mosca
www.thatlldoit.com
http://tech.groups.yahoo.com/group/MS_Access_ProfessionalsMonday, October 31, 2016 9:41 PM