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!

Continuous or Datasheet Subform and using cascading combo boxes

Status
Not open for further replies.

JoeCruse

Technical User
Oct 10, 2003
41
US
Hi to all!

I've looked over the archives and the FAQ's, but did not see anything that gave a good answer to the dilemma I've been working on.
I'm building an application that tracks employee donations. I use a main form to enter date, employee, electronic signature, and a few other things. A subform captures each employee's contribution profile for a particular year (event). This needs to be either a continuous or datasheet subform, as each employee may shoot their payroll deduction towards a large choice of charities. We have 6 different chapters with their own charities, and this is how I broke it down. I have a table with the chapters listed and an ID key. Next a table with all the charities listed, with the chapter ID (foreign key) associated.

In the subform, I've placed two combo boxes that cascade. Use the chapter combo to choose a chapter, and the charity combo gets filtered to those charities belonging to that chapter. This is necessary, because there are different chapters of the same charity (Red Cross in different counties, for example), so there has to be a way to separate them, and this seemed the best.

The combo boxes work fine, on their own, but when put in a continuous or datasheet subform, they do NOT work so well. The first time it is used for each contribution event, it does a great job of filtering the combo box. But when you have someone making several divisions of their contribution to charities in more than one chapter, it becomes ineffective. It will always filter out the charity combo of the record being written. If it's a different chapter, the previous chapter entries for the event lose their charities on the form...they just go blank. Looking at the table, they DO get saved, it's just that they no longer show as they should in the form.

Is this a quirk of Access, that cascading combo boxes do this in continuous or datasheet subforms? There are a couple of good FAQ's on using combo boxes, but none satisfactorily answered this issue, though one tried to (it was hard to tell how the writer implemented his solution though). I've tried a couple of work-arounds, to no avail.

Has anyone successfully broken through this? If you are interested, I can post some code and the underlying row source stuff, if need be. I was just curious as to whether there is an explanation for Access' behavior here and if anyone had battled it out.

Thanks in advance,

Joe Cruse
 
How are ya JoeCruse . . . ..
[blue][purple]Is this a quirk of Access[/purple], that cascading combo boxes do this in continuous or datasheet subforms?[/blue]
No . . . not a quirk. This is what happens with an [blue]unbound combobox[/blue] in [blue]continuous/datasheet[/blue] view of a form. Change one they all change.

The [purple]comboboxes need to be bound to fields in the underlying table[/purple] (ControlSource set to fieldname).

Calvin.gif
See Ya! . . . . . .
 
Hiya AceMan1!

Thanks for responding. Unfortunately, the subform is doing this WITH bound combo boxes. The subform is off a query that is based on an underlying table. The combos are bound to fields in the underlying query, and thus to the underlying table fields. And the values entered in the subform are saved into the table and DO stay there. It's just that the subform acts snarky about the whole thing. I did end up trying an unbound combo, just to see if it would work okay, but it did what you pointed out, and I quickly dropped it.
As I pointed out, there WAS one FAQ that addressed this, but it was not clear, to me anyway, how it was implemented. I'll keep at it, but appreciate any insight anyone could lay down.

Thank you.
 
JoeCruse . . . . .

I'm sorry Joe, [blue]forgot to mention you need code that updates the 2nd combo according to the first when you move from record to record[/blue]. The code would be placed in the On Current event of the subform, which occurs when you move the focus to a different record.

Post the [blue]RowSource[/blue] your currently using for each combo (if query post the SQL) and I'll see what I can do!

Calvin.gif
See Ya! . . . . . .
 
TheAceMan1,

got that too. I've actually tried a couple of variations of RowSource and code for On Current.

The DB is at work, so I'll put it on tomorrow when I get in.

Thanks for your input.
 
AceMan1,

on second thought...DID I do it in the subform's On Current??? I'll have to check that in that morning. I've made that boner before with check boxes. Thanks for reminding me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top