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

Linked Combo Boxes

Status
Not open for further replies.

meg450

Technical User
Apr 28, 2000
6
US
I've been working on this way to long and I am finally giving in and asking for help, please.

I have a form with 3 combo boxes that are linked cbodivision, cbodept, and cbosubdept. When you pick a division, the cbodept box will only show you the choices that are related to the division. The same with cbosubdept you will only see the choices that are related to the dept that was chosen.

The problem that I am having, is when you select the choices it shows the ID Numbers instead of the Name. Is there a way to fix it so it shows the name not the number and still performs correctly. It seems that when I change the bound column to 2 it won’t show the related choices, it just shows me nothing.

My form is based on an Employee Table with a subform of my office affiliation table which has the 3 combo boxes. I’m using the following row source SQL statement in my combo boxes.

[Forms]![Employee Form]![Office Affiliation Subform]![cboDivision] this is my statement for the cbodept box as criteria under the Division ID field.


[Forms]![Employee Form]![Office Affiliation Subform]![cboDept] this is my statement for the cbosubdept box as criteria under the Dept ID field.

I am also using the AfterUpdate to requery the boxes.

Maybe there is another way to do this. Any help would be appreciated. Thanks

 
Ok,

Make sure you have the number of fields property forthe combobox set to 2.

Next make sure that the ID number is in the first column, and that you have bound the control to coluumn 1.

Finally, go to set column widths for the control, and enter 0 (will change to 0cm), this is only the width for the first column.

You should now only see column 2 when viewing, but column 1 is bound to the control.
 
I have also been trying to solve this problem. i have followed what you have suggested and it has worked to a degree. When i set the colunm width to 0cm it just doesn't show anything, niether the ID or description.

So to understand this properly, the second and thrid combo have this done to them to allow them to look up values depending what was selected in the combo before. But i were using this system to add a record would this work ?

Thanks

Chris
 
Thanks Fubear, I have tried that and it works for the first record but when I go to the next record my second and third combo boxes have nothing. When I'm on record 2 and I select something different from my first combo box the name of the second combo box shows up and then I go back to record 1 and the second combo box name is gone. Any other suggestions? Thanks again for trying.
 
If you set the column width, you need to set both columns. So you can set it to: 0;1.5 and the first column will be invisible, 2nd one will be 1.5 inches wide.

Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top