Full Version: Continuous Subform Not Refreshing Properly
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Calfaile
Hello,

I have a continuous subform on my main form that is filtered depending on the value of a combobox (though link master fields and link child fields). I've put a Me.subformControl.Requery in the AfterUpdate of the combobox. However, only the "new"(blank) record in the subform changes to reflect the new combobox value. The records related to the old combobox value stay in the subform until I navigate to a new mainform record or I requery the main form (which I don't want to do since it sends me back to the first record). Am I missing something obvious?

Thanks in advance,

Calfaile
cpetermann
Calfaile,

Would it be possible to zip and attach your db?
If you have sensitive data, make a copy of your db,
remove or replace it with dummy data,
Compact and repair --then zip and attach.

Might be easier if we could actually see the behavior in action smile.gif
gemmathehusky
i think it must be something to do with the way you are linking the form to the subform. is the combo box unbound by any chance?
Calfaile
No, the combobox is bound to the main form. I'll attach the database when I get to work tomorrow, thanks!
cpetermann
Great!

Will look forward to seeing it.
Calfaile
ok. Here it is.

The split form in question is "frmPlasmidsSplit" The subform that isn't loading is the sfrBackboneResistance that is bound to a junction table between backbone and resistance. I put an extra column in there for troubleshooting. The first column is the backbone ID, the second is the resistance (right now either Ampicillin or Kanamycin). The backbone is controlled by the cboBackbone control on the main page. What I want to happen is when you change the value of backbone, only the resistances associated with that backbone should appear in the subform: pFU_W (1) = Ampicillin, pCAG(2) = Kanamycin. Now, when you toggle it, the greyed out subform record changes backboneID, but the existing white record does not reflect the new backboneID.

Thanks again for the help.
Calfaile
So I reverted to another copy of the database (that was originally trapped in a record until I figured out how to debug it) and now it works. I do not know why, but I'm not one to look a gift horse in the mouth. Thanks for the help everyone!
cpetermann
Calfaile,

Glad you found a solution!

Good luck with your project smile.gif
Calfaile
alas, it's happening again. That's the problem with magical solutions
Calfaile
ok, here it is again.
cpetermann
Calfaile,

Several issues I didn't mention earlier because it seemed you had solved your issue:

you need to add Option Explicit
under Option Compare Database:
Option Compare Database
Option Explicit


Check your cbo's Not In List Events--
One of them needs:
Dim strTemp as String
I think it was cboBackbones

Using Fields Captions at the Table level isn't recommended.
It might work if you and only you will ever need to see
the inner workings of your db--
however more times than not, using Captions will cause you headaches
down the road. pullhair.gif

It is difficult for me to try to look for what is causing the current issue,
because of the use of the captions.

And I'm still not clear on what you want to happen in the split form.
Calfaile
Thansk for your tips cpetermann,

Right, I did add option explicit, but that was after I had uploaded the first database, and I hadn't gotten around to fixing the second one yet.

I did catch the missing variable declaration and I'll fix the captions.

What I want is when I change the value of cboBackbone, the subform display the antibiotics bound to that backbone. In this specific example, when I change from FU_W to pCAG, the subform should go from displaying Kanamycin to Ampicillin immediately and not just when I change records.

Thanks.
Calfaile
ok. I think I got all your comments
cpetermann
in the AfterUpdate Event
Add after the End If

Me.Requery

See if this does what you need it to do.
Calfaile
That successfully requeries the subform, but since it requeries the page, it also sends me back to the first record (which is an unwanted behaviour).
cpetermann
Calfaile,

Created a new subform for selecting Backbone
& Backbone Resistance

Give it a try and see if this works for you.
Calfaile
cpetermann,

Thanks for that, I never thought about putting the cboBackbone on the subform. There might be a problem with the fact that cboBackbone needs to trigger changes on the main form, but I can access those controls through a .Parent or Forms!Mainform reference, right? Hopefully I can make this work.

Thanks again for the help,

Calfaile
cpetermann
I hope it works for you.

Good luck with your project smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.