Update combo box after new entry

J

JenK

The form I am trying to get updated is Purchase Orders (PO). I have a button
that opens up my suppliers form to add in a new supplier. My current problem
is that in order for the new supplier to appear in my combo box I have to
close the PO form and re-open it. Is there a code that I can attach to my
supplier form that when it is closed it will update my supplier combo box on
my PO form.
I think it is fairly simple I just haven't found the answer yet.
Thank-you
 
D

Douglas J. Steele

Issue a Requery on the combo box.

If you're doing this from code running on the form where the combo box
exists, something like:

Me![NameOfComboBox].Requery

If you're doing it from elsewhere, something like:

Forms![NameOfForm]![NameOfComboBox].Requery
 
S

strive4peace

Hi Jen,

put this code on the Unload event of your suppliers form:

'~~~~~~~~~
if currentproject.Allforms("formname").IsLoaded = true then
forms!formname!controlname.Requery
DoEvents
End If
'~~~~~~~~~

WHERE
formname is the Name of your PO form
controlname is the Name of the supplier combo control


Warm Regards,
Crystal
remote programming and training

Video Tutorials on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 
J

JenK

That worked great thank-you for your help

strive4peace said:
Hi Jen,

put this code on the Unload event of your suppliers form:

'~~~~~~~~~
if currentproject.Allforms("formname").IsLoaded = true then
forms!formname!controlname.Requery
DoEvents
End If
'~~~~~~~~~

WHERE
formname is the Name of your PO form
controlname is the Name of the supplier combo control


Warm Regards,
Crystal
remote programming and training

Video Tutorials on YouTube!
http://www.youtube.com/user/LearnAccessByCrystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.AccessMVP.com/strive4peace

*
:) have an awesome day :)
*
 

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