-----Original Message-----
Hi Donald,
As Ken says it depends on how you receive the data. Assuming these are
values in a text field in a table, you'd use an update query that calls
a VBA function to actually insert the dashes in each string.
Here's a simple function that will do the job (there are ways of
speeding it up if you're continually processing many thousands of
strings).
Public Function InsertDashEvery3rdChar(V As Variant) As Variant
Dim oRE As Object, varTemp As Variant
Set oRE = CreateObject("VBScript.RegExp")
With oRE
.Global = True
.IgnoreCase = True
.Multiline = False
.Pattern = "(...)(?!$)" 'regular expression matching
'3 characters not at end of string
varTemp = .Replace(CStr(Nz(V, "")), "$1-")
End With
InsertDashEvery3rdChar = varTemp
Set oRE = Nothing
End Function
if i receive a string of data and AAABBBCCCDDD and after
every 3rd letter, i want to insert a dash, how would i go
about doing that? sometimes the data will have just
AAABBBCCC, AAABBBAAACCCDDD, AAABBBCCCBBBDDDAAA, etc but is
ALWAYS in multiples of 3.
thanks
DW
--
John Nurick [Microsoft Access MVP]
Please respond in the newgroup and not by email.
.