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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allow only 1 user to select hemself from a combo box

Status
Not open for further replies.

SDS100UK

MIS
Joined
Jul 15, 2001
Messages
185
Location
GB
Hi,

I have a combo box with a list of team leaders in. This then provides the basis for team leaders to select reports with the appropriate team data in.

What I want to do is make sure a Team leader can only pick themself from the list....with some form of password/security maybe???

Is it possible???

Anyone know how?

TIA

Steven
 
Hi,

There are a few ways of doing this, so if you provide more info you could be helped further.

Do you have a users table? If so, you can run your query for the combobox with the criteria to only include the current user.

Are you using Access security?

If so, you could use the users table as a lookup to find their fullnames from the UserID they use.


Dean.
 
do your team managers log into the pc's they use?
if so why not try to default the text box using there login ID

Be ALERT - Your country needs Lerts
 
Thanks DeanWiliams
Yes I have a table with Team leaders in it. With all the relevant data in about them,. The Combo box is used as part of the criteria for and underlying query.

I am not using access security.

Thanks

Steven
 
you dont need to use access securirty to get the user id. try this code.

paste it into a module called 'user'
'<<=============================>>

Option Compare Database
Option Explicit

Private Declare Function apiGetUserName Lib &quot;advapi32.dll&quot; Alias _
&quot;GetUserNameA&quot; (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX <> 0 Then
fOSUserName = left$(strUserName, lngLen - 1)
Else
fOSUserName = &quot;&quot;
End If
End Function

'<<<=================>>>



now in a form create a text box and set the default value to
=fOSUserName()

then run the form, you should see your novell login id.

if you set the reference of the query to this box, you will only list results that pertain to you

Be ALERT - Your country needs Lerts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top