Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to show logged on user is user self

Status
Not open for further replies.

codingal

Technical User
Jul 17, 2007
4
US
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
 
If varItems(y, x) = Chr$(34) Like "*" & CurrentUser() & "*" & Chr$(34) Then

this line actually works?

--------------------
Procrastinate Now!
 
Why not simply this ?
If varItems(y, x) Like "*" & CurrentUser() & "*" Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
wow thanks guys, it is now working beautifully. here is the code that works, hope it helps those who want to do the same:

If Not IsNull(varItems(y, x)) Then
If varItems(y, x) Like "*" & CurrentUser() & "*" Then
strReturn = strReturn & Chr$(34) & Left$(varItems(y, x), Len(Trim(varItems(y, x))) - 1) & "(You)" & Chr$(34) & ";"
Else
strReturn = strReturn & Chr$(34) & Left$(varItems(y, x), Len(Trim(varItems(y, x))) - 1) & Chr$(34) & ";"
End If

End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top