I am using a function to populate a listbox to show on a form a list of logged on users. If the user name is current user, I want to show "(You)" next to the user id. Maybe because I am not using the correct delimiters or wildcards, somehow I can't get the "(You)" next to the current users. I can put "(You)" next to all users though. Please help! Thanks!
here is part of the code:
varItems = rst.GetRows()
For x = LBound(varItems, 2) To UBound(varItems, 2)
For y = LBound(varItems, 1) To UBound(varItems, 1)
If Not IsNull(varItems(y, x)) Then
strReturn = strReturn & Chr$(34) & Left$(varItems(y, x), Len(Trim(varItems(y, x))) - 1) & Chr$(34) & ";"
If varItems(y, x) = Chr$(34) Like "*" & CurrentUser() & "*" & Chr$(34) Then
strReturn = strReturn & Chr$(34) & Left$(varItems(y, x), Len(Trim(varItems(y, x))) - 1) & "(You)" & Chr$(34) & ";"
End If
End If
Next y
Next x
BuildString = strReturn
here is part of the code:
varItems = rst.GetRows()
For x = LBound(varItems, 2) To UBound(varItems, 2)
For y = LBound(varItems, 1) To UBound(varItems, 1)
If Not IsNull(varItems(y, x)) Then
strReturn = strReturn & Chr$(34) & Left$(varItems(y, x), Len(Trim(varItems(y, x))) - 1) & Chr$(34) & ";"
If varItems(y, x) = Chr$(34) Like "*" & CurrentUser() & "*" & Chr$(34) Then
strReturn = strReturn & Chr$(34) & Left$(varItems(y, x), Len(Trim(varItems(y, x))) - 1) & "(You)" & Chr$(34) & ";"
End If
End If
Next y
Next x
BuildString = strReturn