Can't refresh combox box and/or query

swindsorct
swindsorct used Ask the Experts™
on
I am having difficult getting a combobox field to refresh/requery…

I have a table of  customers, with an autonumber key.   I have a second table of contacts for those customers (also with autonumber key).  Because the contacts may be attached to multiple customers  I have created a link table where the customer autonumber and the contact auto numbers are stored.    When I display the customer,  a subform of this linked table filters on the customer number, and displays a list of matching links.   To display the contacts in a human friendly manner I have a combo box based on a query of the contact table.

This is so that in the event one contact is used of multiple customers there is only on contact to maintain.  So far all this works well.  If the user double clicks a contact in the combo box  that contact opens for display and editing.

When the user double clicks the blank bottom (add a record row)  contact,  the form opens with a blank record to be added.    Records add just fine.  But when I go back to the combo form,  the new record is on there….in the combo box.   I have found that the record has been added to the contact table, and the link table.    It seems the query has not refreshed/requeried, and/or the form/ combo box has not refreshed/requeried.

It has been a log time since I have done this programming,  I get the feeling I am looking straight at the problem…..and not seeing it.   (can’t see the forest cause all those trees are in the way).

i'm using ms access 2003
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016

Commented:
after adding the record, you need to requery the combo box

Forms!nameOfForm!comboName.requery

Author

Commented:
Tried that.  Perhaps I adding it to the wrong place.  In the contactsadd form  it gives me the error It cant find the control.
Top Expert 2016

Commented:
what is the name of the form where the combo box is?
what is the name of the combo box?
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Author

Commented:
the combo box name contact  is on a form name links.

links is a sub form on the for clients

i"ve tried    forms!links!contacts.requery   and forms!clients!contact.requery

on form!links   i put it in on update   and on add         on forms!clients   on update

the add a record form that is opened  form!contacts   on add, on update and on close
Top Expert 2016
Commented:
try this then

forms!clients!links.form.contact.requery

Author

Commented:
Thast hit the nail right on the head.    Thank you!!!!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial