requery

H

hagen31

I had two tables that were many to many. So I split that up into 3
tables(1,2,3). Then I created some forms. Now I have a main form for entering
customers and a subform for the products they buy. I want my user to be able
to go to this main form and have the ability to add a new product that will
show up when they close the product form(which links to the subform to solve
the many to many problem). I create a button to open the products form and am
able to requery that, but how do I requery the customer and product
connection form(which is really what my subform is) to have the new product
show up. I should also mention that when the product shows up it is a
combination of three fields.

Thanks,

Austin
 
A

Allen Browne

I thing you have:
- a main form bound to your Customer table;
- a subform bound to the CustomerProduct table (junction table);
- in the subform, a combo that has your Product table as RowSource.

Then you have a separate form where you enter new products, and you want the
combo in the subform to automatically hear about the new product?

In the AfterUpdate event of your Product *form* (not control on the form),
Requery the combo. The code will look something like this:

Private Sub Form_AfterUpdate()
Forms![Customer]![CustomerProduct].Form.[ProductID].Requery
End Sub
 
Top