Rabu, 24 Agustus 2016

Re: [MS_AccessPros] Need to know how many of each digit in a series of unit numbers.

 

Rajiv-


Very creative.  I would still convert the Long to a String using Format first to not drop leading zeros.

Public Function IntCount(LngUnit As Long, Dig As Integer) As Integer
Dim strUnit As String
strUnit = Format(lngUnit, "00000")
IntCount = Len(strUnit & "") - Len(Replace(strUnit & "", Dig, ""))

End 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 Aug 24, 2016, at 12:46 PM, torajiv@gmail.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:



How about

Public Function IntCount(LngUnit As Long, Dig As Integer) As Integer

IntCount = Len(LngUnit & "") - Len(Replace(LngUnit & "", Dig, ""))

End Function


Rajiv





__._,_.___

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 (11)

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:

Poskan Komentar