Update combo box after new entry

  • Thread starter Thread starter JenK
  • Start date Start date
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
 
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
 
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 :)
*
 
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 :)
*
 
Back
Top