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

Combo Box lists user

Status
Not open for further replies.

nycbigapple

Technical User
Apr 4, 2006
33
0
0
US
Hi,

I have a database where users login into the Db. On a particular form, there is a combo box where I only want the user logged in name to appear. This is what I have and it works.

Form_Current
Code:
Me!cboInitBy.RowSource = "SELECT EmpID, LName & FROM qryemplist  WHERE (((qryemplist.EmpID)=forms!frmncr!txtEmpID))"

This is where my dilemma is:
If user A logged in and accessed record 101 and selected their name, and logs out.

User B logs in and accesses record 101 that combo box displays that it is empty but it isn't. How can I code it so that displays User A name but the record source will only display User B name from the list to choose.

I hope I was able to explain
 
nycbigapple,
Simple answer: you can't. If two options appear in the Combobox, then by default the user will be able to select either of the two.

A couple of thoughts:

You could code an event (OnChange, BeforeUpdate) event to prevent the user from selecting anything but their name.

Disable the ComboBox and provide a Button the user can use to update the value in the ComboBox to their [tt]EmpID[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top