requery a query on close_form event?

  • Thread starter Thread starter danielle
  • Start date Start date
D

danielle

Is there a way to requery a cbobox that is named the same
on 5 different subforms. I have an add new contact button
that opens a pop-up form to enter the new contact
information. After the user closes this form I want the
cbobox to requery so the user can select from the list.
Can I requery a query in the database?
I have tried to code this in the form_close event.
(requery method-- I was not successful in that, but maybe
I did something wrong)

structure:
5 forms each with own subform.
Subforms all have a contact cbobox filled by same query.

danielle
 
Danielle,

Do you mean all 5 forms are open at the time? If so, as far as I know
the simplest way is to query each combobox individually.
Forms!NameOfForm!NameOfSubform.Form!NameOfCombobox.Requery

Having said that, your form structure is, in my experience, very
unusual, and I suspect more complicated than it needs to be.
 
No, the forms are not open at the same time. The form is
only open when the user does so. The reason I use the pop-
up form is to allow the user to enter a new contact to
select from in the subform cbo box. Each of these forms
are specific to different data. The only thing in common
is a contract number.

Example of how this is set up.

frmPatents (main contract information)
subfrmPatents_Main (patent information) - subfrmPatents
(inventor information. subfrm in subfrmpatents_Main)

I have been using acess for since 2.0 and for some reason
this problem is driving me mad! More or less that is why
this is such a strange setup.
 
Danielle,

Thanks for the further clarification. So now I don't understand the
problem at all. You are using a popup form to enter a new contact to
the table that is the basis of the row source of the comboboxes on the
subforms. Fine. If the forms are closed at the time, the comboboxes
should automatically include the newly added contact, whenever the form
is opened. There should be no need to requery anything. What am I missing?
 
Back
Top