By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

Combo boxes on form not populating with stored data

P: 12
Hi,

I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo box to list only those factors that are part of the selected sub-area.

For example, if I select area 1.0, the Sub-Area combo box displays 1.1, 1.2, and 1.3 as options. It does not show 2.1, 3.1, etc.

If I select area 2.0, the Sub-Area combo box displays only 2.1, not 1.1, 1.2, 3.1, etc.

I think you get the idea.

The combo boxes are working properly and the data is being stored in the table correctly. However, when I go back and view the records through my form, the combo boxes are empty. When I click on the empty combo box, the correct value is highlighted in the list... it just wasn't showing when I first look at the record.

Any ideas on how to have the combo boxes correctly populate with the stored values?
Aug 1 '08 #1
Share this Question
Share on Google+
11 Replies


missinglinq
Expert 2.5K+
P: 3,532
In order for a given record to retain the value of its comboboxes when you leave the record and then return, the comboboxes have to be bound to fields in the underlying table. When you select a combobox and go to its Properties sheet, does it have anything listed under Control Source?

Welcome toes Bytes!

Linq ;0)>
Aug 1 '08 #2

P: 12
Yes, sorry I didn't make that clear originally. The data is being stored in the tables... the control sources are set up properly.

The issue that when I go back and look at records through the form, the field doesn't populate until I click into the combo box.
Aug 1 '08 #3

P: 12
twenty character bump
Aug 5 '08 #4

NeoPa
Expert Mod 15k+
P: 31,494
When you say the field (control) doesn't populate, do you mean that the selected item is not shown in the unopened ComboBox?

If not, what do you mean exactly?
Aug 10 '08 #5

P: 12
Yes, the selected item is not shown in the unopened combo box. When I click into the combo box, the selected item appears. The selected item will then stay visible as long as I view that record. When I go to the next record and then come back, the selected item is hidden once again.
Aug 14 '08 #6

missinglinq
Expert 2.5K+
P: 3,532
If the comobox itself has a Control Source set, it shouldn't do that. It sounds as if something in the OnCurrent event is setting the combobox default back to no selection. My only other guess would be some weird for of corruption, in which case deleting the combobox and recreating it would be the answer.

Linq ;0)>
Aug 14 '08 #7

P: 12
I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo box to list only those factors that are part of the selected sub-area.

For example, if I select area 1.0, the Sub-Area combo box displays 1.1, 1.2, and 1.3 as options. It does not show 2.1, 3.1, etc.

If I select area 2.0, the Sub-Area combo box displays only 2.1, not 1.1, 1.2, 3.1, etc.
In order to implement this design I use requery macros for the On Click and On Enter events of the combo box. Basically when I make a selection in the Area combo box, I want the Sub-Area choices to be tailored to that Area.

Perhaps these requery macros are to blame?
Aug 14 '08 #8

missinglinq
Expert 2.5K+
P: 3,532
Few of us here use Macros, but Requerying a combobox normally will reset it, so that may be the problem. Maybe someone will stop by who does use Macros.

Linq ;0)>
Aug 14 '08 #9

NeoPa
Expert Mod 15k+
P: 31,494
If you were to reproduce the macro functionality in VBA, then you would have the opportunity of coding it to save the value before the requery, then simply setting it again afterwards. That might do the trick for you.
Aug 14 '08 #10

P: 12
Huzzah!

I replaced the macros with VBA such that in the "After Update" event of a combo box I requery the next combo box down the line. This still left me with the original problem of invisible values when navigating through records.

I fixed that by requerying each of the combo boxes in the form's "On Current" event.

Thanks so much for your help neo and linq.

*Edited for grammar
Aug 15 '08 #11

NeoPa
Expert Mod 15k+
P: 31,494
You're welcome.

We're very pleased we could help :)

Wecome to Bytes!
Aug 15 '08 #12

Post your reply

Sign in to post your reply or Sign up for a free account.