Technically speaking, the computer would be doing unnecessary work (the "replace" portion) with the shorter option, but chances are that it'll make no noticeable difference, and even if you're concerned about the speed difference, the built-in functions may well end up executing faster than iterating through the string with VB anyway.
Rob
"Adam Milligan" <AdamMilligan[ at ]discussions.microsoft.com> wrote in message news:FC559671-D884-4EFB-BCEF-28029E9C5E3D[ at ]microsoft.com...
[Quoted Text] > Thanks! I hope Mr. Patrick isn't offended if I chose to use the shorter > of > the two options. > > "Douglas J Steele" wrote: > >> The number of dots in a string will be equal to: >> >> Len(MyString) - Len(Replace(MyString, ".", "") >> >> -- >> Doug Steele, Microsoft Access MVP >> http://I.Am/DougSteele>> (no e-mails, please!) >> >> >> "Adam Milligan" <AdamMilligan[ at ]discussions.microsoft.com> wrote in message >> news:DD57B8E9-5D81-4DF5-BAF8-D0C00211E527[ at ]microsoft.com... >> > Is there a way in VBA to open a recordset, and count the number of dots >> > in >> a >> > text field? For example a value of 1 would return 0, but a value of >> 1.4.2.1 >> > would return 3. I am trying to determine at what level of a hierarchy >> > a >> > particular record falls. Thanks. >> > >> > Adam Milligan >> >> >>
|