472,142 Members | 1,035 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Combo boxes on form not populating with stored data

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
11 2860
missinglinq
3,532 Expert 2GB
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
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
twenty character bump
Aug 5 '08 #4
NeoPa
32,498 Expert Mod 16PB
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
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
3,532 Expert 2GB
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
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
3,532 Expert 2GB
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
32,498 Expert Mod 16PB
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
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
32,498 Expert Mod 16PB
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.

Similar topics

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.