Refreshing a combo box's contents.

R

Richard Horne

I have built an ordering system and I have just noticed one small problem.

Within the order form you have the option to add a new customer by clicking
the 'Add new customer' button. This takes you to the customer entry form
where you can add the address details etc. The problem is that when I go back
to my order form, the name I just added to the database isn't added to the
combo box used to select the customer placing the order, until closing out
and re-opening the form.

How can I get around this?
 
A

Andi Mayer

I have built an ordering system and I have just noticed one small problem.

Within the order form you have the option to add a new customer by clicking
the 'Add new customer' button. This takes you to the customer entry form
where you can add the address details etc. The problem is that when I go back
to my order form, the name I just added to the database isn't added to the
combo box used to select the customer placing the order, until closing out
and re-opening the form.

How can I get around this?

First: use google to find an answer to your question Like:
(watch for line breaks)
http://groups-beta.google.com/group...'s+contents+group:*access*&qt_s=Search+Groups

give 2 results( the first is yours) and the second is the answer

a search with
"Refreshing combo box group:*access*
gives you 281 answers

with
"Refreshing combobox group:*access*"
gives 319 Hits
 
R

Richard Horne

I've read some solutions to similar problems and have sort of got this
working using:

Forms!FormName!ComboBoxName.Requery

and I've assigned this to the close event.

But this only works if the Form I want to requery is open. If it's not open
I get an error message. How do I prevent this from happening?
 
A

Andi Mayer

I've read some solutions to similar problems and have sort of got this
working using:

Forms!FormName!ComboBoxName.Requery

and I've assigned this to the close event.

But this only works if the Form I want to requery is open. If it's not open
I get an error message. How do I prevent this from happening?

close event of the mainform?

this is useless, because you can't get information out of a closed
form (on close means: after the form is closed do something)


use the "customer entry" form onCloseEvent and write

Forms("OrderFormName")!ComboBoxName.Requery

this works only if the Form "OrderFormName" is open
 
Top