UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Combo Box duplicate selection    
 
   
kbuttars
post Aug 8 2005, 03:27 AM
Post #1

UtterAccess Member
Posts: 28
From: Idaho



In a training form for my employee database, I have a combo box listing all company employees. The employees are selected from the combo box to attend a specific class. What properties do I set to make sure that an employee is only selected one time from the combo box per class? What I would really like it to do is after an employee is selected - make them unselectable or remove the name from the list for the specific training class schedule. Can this be done?

Thanks so much!
Kathi
Go to the top of the page
 
+
ScottGem
post Aug 8 2005, 11:34 PM
Post #2

UtterAccess VIP / UA Clown
Posts: 25,021
From: LI, NY



In the query behind the combo you filter out those already selected. The RowSource would look something like this:

SELECT EmployeeID, [Last] & ", " & [First] AS fullname FROM tblEmployees
WHERE EmployeeID NOT IN(SELECT EmployeeID FROM tblCLasses WHERE ClassID = Forms!formname!controlname)
ORDER BY last, First;

The subselect lists all employees who have been assigned to a Class shown in what referenced control. By using the NOT IN operator, you exclude those employees.
Go to the top of the page
 
+
kbuttars
post Aug 9 2005, 01:56 AM
Post #3

UtterAccess Member
Posts: 28
From: Idaho



Scott -
Thank you! Your suggestion worked perfectly. I appreciate your help.

Kathi
Go to the top of the page
 
+
doodle
post Aug 9 2005, 02:48 AM
Post #4

UtterAccess Addict
Posts: 296
From: Alberta, Canada



Hiya guys,

Thank you Scott, your suggestion worked out great for another form I had roughly the same idea just with products, I didn't want the user to be able to select the same product twice in the same purchase order. I had a form in continous mode and had a series of combos, I resorted to convolted VBA code to get it to work ( with flaws), but your idea worked flawlessly with much less effort.

Thanks again.

David.
Go to the top of the page
 
+
ScottGem
post Aug 9 2005, 03:35 AM
Post #5

UtterAccess VIP / UA Clown
Posts: 25,021
From: LI, NY



That's me. Do it the easiest way possible (IMG:http://www.utteraccess.com/forum/style_emoticons/default/wink.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 01:24 PM