CascadingComboInSubform.mdb (intermediate) |
Post Reply |
Author | |
Roger Carlson
Microsoft MVP Joined: 20 Feb 2008 Status: Offline Points: 261 |
Post Options
Thanks(0)
Posted: 03 Aug 2008 at 11:05pm |
Please consider donating $1 per sample downloaded, find out why here.
CascadingComboInSubform.mdb Here's the problem: The normal method of cascading combos is to reference the first combobox in the rowsource of the second and also requery the second combo after the first is updated. This works fine in a single-form view of a form. Unfortunately, as the sample illustrates, this won't work in a continuous form. Only the active record will show the value in the second combo. It is still there, but you can't see it, because that value is no longer in the rowsource.
Here's the solution: Programmatically modify the rowsource, so it references the first combobox ONLY when the second combobox has the focus (the code in in the OnGotFocus event of the second combo) and when it looses focus, change the row source so that it shows the whole list. Caveat: There are circumstances under which the values can appear to vanish, as in the problem form. The there is code in the LostFocus event of the second combo that requeries subform, but the bookmark needs to be stored, otherwize the focus will return to the first record in the subform. The best I can come up with is to return to the same record you just left. It is not perfect, but gets you in the ballpark. -RC |
|
|
|
Sponsored Links | Want a good read? Try The Summer of His Life (available on Amazon!) |
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |