'Check help topic "Quotation Marks in Strings"
'strings in strings are a pain in domain aggr functions
Private Function strUnique() As String
'concatenates unique integer with a default string
'to create a unique identifier
'example uses "_default" for default string
'change index arg of Left() as needed.
Dim strCnt As Integer
Dim dcnt As Integer
Dim su As String
'count how many records have "_default" as
'first 8 characters of [TextField], add 1
strCnt = DCount("[TextField]", "tblTable", "Left([TextField],8) = '_default'"
+ 1
dcnt = strCnt
'goes into loop dcnt >= 1
Do Until dcnt = 0
su = "_default" & strCnt
'now check for records with su in TextField
dcnt = DCount("[TextField]", "tblTable", "[TextField]='" & su & "'"
'add count of records with su in TextField to strCnt
strCnt = strCnt + dcnt
Loop
strUnique = su
End Function
'strings in strings are a pain in domain aggr functions
Private Function strUnique() As String
'concatenates unique integer with a default string
'to create a unique identifier
'example uses "_default" for default string
'change index arg of Left() as needed.
Dim strCnt As Integer
Dim dcnt As Integer
Dim su As String
'count how many records have "_default" as
'first 8 characters of [TextField], add 1
strCnt = DCount("[TextField]", "tblTable", "Left([TextField],8) = '_default'"
dcnt = strCnt
'goes into loop dcnt >= 1
Do Until dcnt = 0
su = "_default" & strCnt
'now check for records with su in TextField
dcnt = DCount("[TextField]", "tblTable", "[TextField]='" & su & "'"
'add count of records with su in TextField to strCnt
strCnt = strCnt + dcnt
Loop
strUnique = su
End Function