Requery one subform from another subform

C

CJ

Hi Groupies

My Main form (frmProjectMaster) contains 2 levels of subforms. The first
subform is frmCompartmentsWizard. frmCompartmentsWizard contains
fsubBlocksWizard and fsubReefersWizard. On fsubBlocksWizard, there is a
combo box called strStockCode that gets its data from tblReefers. tblReefers
happens to be the data source for fsubReefersWizard.

What I need to happen is this:
When a new record is added in fsubReefersWizard, I need the combo
box on fsubBlocksWizard to requery so that the new data shows up. I need to
stay in fsubReefersWizard.

I am having trouble figuring out how to write the requery for the combo.

Could somebody please get this straight for me?

Thanks for the brainwaves!
CJ
 
M

Marshall Barton

CJ said:
Hi Groupies

My Main form (frmProjectMaster) contains 2 levels of subforms. The first
subform is frmCompartmentsWizard. frmCompartmentsWizard contains
fsubBlocksWizard and fsubReefersWizard. On fsubBlocksWizard, there is a
combo box called strStockCode that gets its data from tblReefers. tblReefers
happens to be the data source for fsubReefersWizard.

What I need to happen is this:
When a new record is added in fsubReefersWizard, I need the combo
box on fsubBlocksWizard to requery so that the new data shows up. I need to
stay in fsubReefersWizard.


Use the fsubReefersWizard Form's AfterInsert event:

Parent.fsubBlocksWizard.Form.strStockCode.Requery
 
C

CJ

Marshall Barton said:
Use the fsubReefersWizard Form's AfterInsert event:

Parent.fsubBlocksWizard.Form.strStockCode.Requery

Hi Marsh

I tried that but the combo still does not update until after I close the
form and open it up again.

CJ
 
M

Marshall Barton

CJ said:
"Marshall Barton" wrote

I tried that but the combo still does not update until after I close the
form and open it up again.


I've never had a problem doing this kind of thing. Are you
sure you put everything in the right place with the right
names? OTOH, maybe there's another factor we need to take
into account.
 
C

CJ

Marshall Barton said:
I've never had a problem doing this kind of thing. Are you
sure you put everything in the right place with the right
names? OTOH, maybe there's another factor we need to take
into account.

No worries Marsh.

I was testing by only changing the value, not entering a new record. I had
to add the code to the After Insert event so that it updates after the value
is changed. It works perfectly!

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top