How refresh/requery combobox on 1st form when 2nd form closes

I have a combobox on form 1 which the user uses to select a record to open form 2.  When form 2 closes via a command button I want the records in the combobox on form 1 to be requeried.

How can I do this?

--Steve
SteveL13Asked:
Who is Participating?
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.

Jeffrey CoachmanMIS LiasonCommented:
Try:

Forms!Form1!YourCombobox.Requery
0
IrogSintaCommented:
In the code of your Command Button in form 2 that closes the form, add:
Forms!NameOfForm1!NameOfCombobox.Requery

Edit... same as Jeff posted above.
0
SteveL13Author Commented:
I am so sorry... I forgot one thing.   There will be times when form 1 isn't open.  So the code has to check for that first.  

??
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!

IrogSintaCommented:
Here you go:
If CurrentProject.AllForms("NameOfForm1").IsLoaded = True Then
    Forms!NameOfForm1!NameOfCombobox.Requery
End If
0
SteveL13Author Commented:
Hmmm, that didn't work.  When I got back to form 1 the records in the combobox were not requeried.
0
IrogSintaCommented:
I'm thinking you're updating a record in form2 and not saving it when you close the form.  Try adding Dirty = False prior to the requery.  If this does not work, post the RowSource of your combobox.
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
Jeffrey CoachmanMIS LiasonCommented:
Steve,

1. Ron's coding looks solid...
(silly question, did you substitute your actual object names in his code...?)
;-)

2. Make sure you code is actually "adding" this value to the underlying table...
For example, if you run Ron's code, ...immediately open the *Table* that stores this value, ...is the value added?

JeffCoachman
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.