Continuous Form Stored Proc Combo Box (1 Viewer)

Alibaba

New member
Local time
Today, 17:15
Joined
May 29, 2008
Messages
8
Hello,
I have an Access ADP form. The form is bound to a table1. The fields are displaying fine inside the fields and the combo box. behind the combo box is stored procedure A and the combo box is bound to Field1 . For display purposes it is working fine. For data entry purposes, it's not. Because I need that combo box choices limited to the applicable employee. For simplicity let's assume it's another table that has the employee favorite colors. let's also assume, the combo box named today's favorite color. How do I get the choices in the combo box to display the favorite colors for that employee only. Thanks!
 

Ranman256

Well-known member
Local time
Today, 17:15
Joined
Apr 9, 2015
Messages
4,337
somewhere is a table for that employee 123.
123, blue
123, red
552, black
453, red

the query that give the items in the combo box must look at the employee, so
assign the combo to this query qsColorsBy1Emp.
qsColorsBy1Emp = select [color] from table where [empID] = 123

(it only pulls colors owned by the emp)
NOTE, you must refresh the query everytime you change to a different empoyee record, so in the form_ONCURRENT event
cboColor.requery

now every record you goto in the employee, the combo box will refresh to THAT employees colors.
 

Alibaba

New member
Local time
Today, 17:15
Joined
May 29, 2008
Messages
8
Thanks here is what I did ..


Placed a bound combobox on the form with all of the choices available. This would be my display combo.
Then placee another BOUND combo box for the field I wanted edited. This is the combo with all choices for the employee only (filtered)

I made sure the edit combo is hidden behind the display combo. Same size and aligned top left with the other box. (NOT invisible, just hidden)


The first bound combo box includes all choices for all employees. The 2nd box includes choices only for the current employee on the continuous form.

In the OnEnter or OnClick event of the unfiltered box give the filtered combobox focus (go to control).
This will bring the filtered combobox to the forefront. When focus leaves the filtered combobox it will hide itself once more.

anything you select now will update both combo boxes since they are bound to the same control or field

thanks!
 

Users who are viewing this thread

Top Bottom