How to refresh/requery a subform to show newly added record?

I have a form with an unbound combo box that is used to filter a subform.  When I add a record in the subform and hit enter, I'd like the subform to show the new record automatically.  

Right now I can only see the new record if I go back to the main form and select an option from the combo box again.

I've tried, in the AfterUpdate event of a control on the subform:
Me.Requery
Me.Refresh
Me. Dirty = false
Also tried some longer versions of requery specifying the names of the forms:  i.e. Forms!mainformname!subformname.Form.Requery

Can someone help me with the right code?
LVL 1
fabi2004CIOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PatHartmanCommented:
Are you saying that when you add a record to the subform, you want the RowSource of the combo to update to reflect the new record?

If that is the situation, then you have to requery the combo in the AfterUpdate event of the subform.  The subform isn't saved until the subform's AfterUpdate event runs.

Then you would use:

Me.Parent.cboWhatever.Requery
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fabi2004CIOAuthor Commented:
Thank you.  I was requerying the subform instead of the control.
0
PatHartmanCommented:
You're welcome.  But, you still need to wait until the FORM's AfterUpdate event.  The subform record hasn't yet been saved when you do the requery in some random control on the subform.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

fabi2004CIOAuthor Commented:
Right.  So I put this "Me.Parent.cboWhatever.Requery" in the SubForm's After Update Event and it triggers when I move to a different record on the subform or when I hit "enter".  Right?
0
PatHartmanCommented:
Yes.  Or if you have a save button or if you click into the main form. Access is obsessed with saving your data.
0
fabi2004CIOAuthor Commented:
"Access is obsessed with saving your data."  ha!  That's a good thing - mostly.

Thanks for your help Pat.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.