473,320 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Returning sorted list to combo box

I have a form (myForm) which has the following combo boxes:
1) Shift (selects shift 1, 2, or 3 from tblShift) this value is not
stored in a field.
2) Department (selects Dept1, Dept2, or Dept3 from tblDept) this value
is also not stored.

3) Then I have a combo box for Employees' names. This list is
generated from tblEmployees w/ fields FirstName, LastName, Shift, and
Department.

On myForm, is it possible to select the Shift number, the Department
name and have Access only return the names of the corresponding
employees to my Employees name combo box so that the user only chooses
employee names for the chosen shift and department instead of the
whole plant?

Thanks in advance,

Tim

Nov 11 '07 #1
3 1408
yes. change the RowSource for the third combo box to

SELECT FirstName, LastName FROM tblEmployees WHERE Shift =
Forms!myForm!cboShift And Department = Forms!myForm!cboDepartment

the above statement goes all on one line in the combobox's RowSource,
regardless of line wrap here. add the following code to the AfterUpdate
event procedures of the Shift and Department combo box controls, as

Me!cboEmployee.Requery

change the names of the combo box controls in the RowSource and the code
above, to the "real" names in your form, and ditto the form name.

hth
<tb******@gmail.comwrote in message
news:11**********************@o3g2000hsb.googlegro ups.com...
I have a form (myForm) which has the following combo boxes:
1) Shift (selects shift 1, 2, or 3 from tblShift) this value is not
stored in a field.
2) Department (selects Dept1, Dept2, or Dept3 from tblDept) this value
is also not stored.

3) Then I have a combo box for Employees' names. This list is
generated from tblEmployees w/ fields FirstName, LastName, Shift, and
Department.

On myForm, is it possible to select the Shift number, the Department
name and have Access only return the names of the corresponding
employees to my Employees name combo box so that the user only chooses
employee names for the chosen shift and department instead of the
whole plant?

Thanks in advance,

Tim

Nov 11 '07 #2
Thanks Tina! That worked.

Tim

Nov 12 '07 #3
you're welcome :)
<tb******@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
Thanks Tina! That worked.

Tim

Nov 13 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

57
by: Egor Bolonev | last post by:
why functions created with lambda forms cannot contain statements? how to get unnamed function with statements?
5
by: MackS | last post by:
Dear all, I've got several large sets in my program. After performing several operations on these I wish to present one set to the user sorted according to a certain criterion. Is there any...
10
by: Der Andere | last post by:
I need to implement a sorted (ordered) list. STL has no sorted list type as far as I know. Is there a (straight) way to implement a sorted list using STL? BTW: The type of items in the list will...
3
by: Andrew Clark | last post by:
*** post for FREE via your newsreader at post.newsfeed.com *** it's been a while since i have poseted to this newsgroup, but for a long time i was not programming at all. but now that i am out of...
3
by: ScottBH | last post by:
Discovered a fun one that I thought I should share, and hopefully catch Microsoft's attention to update some documentation. I'm a bit new to VB.NET, and was struggling with getting a combo box to...
1
by: J L | last post by:
I want to create a sorted list whose values are themselves sorted lists. I wrote the following simple test program but it does not behave as I would expect. What I wanted to do was have the...
4
by: shrishjain | last post by:
Hi All, I need a type where I can store my items in sorted order. And I want to keep adding items to it, and want it to remain sorted. Is there any type in .net which I can make use of. I see...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
8
by: Guy | last post by:
Is there a better way to search identical elements in a sorted array list than the following: iIndex = Array.BinarySearch( m_Array, 0, m_Array.Count, aSearchedObject ); aFoundObject= m_Array;...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.