Macro to update data in subfrom

  • Thread starter Thread starter Woodstock
  • Start date Start date
W

Woodstock

Good morning,

Firstly I am a complete beginner with Access, and I am currently undertaking
a large project to create a management system for my work, so I will probably
be asking for a lot of help from all of you on here! So, my first problem is
this: I have a form which is used to display information on customers, and
then a subform showing all of their orders from a query. The user selects the
customer from a combo box on the form. There is a text box hidden in the
footer, which takes the 'ID' number of the customer from the combo box. The
query is filtered on the field 'customer name' by whatever number is in the
text box, which in turn is controlled by the combo box. That's all good and
well, apart from that I want the subform/query to refresh and update
automatically whenever a different customer is selected from the combo box so
that that customer's orders are displayed, but for some reason this isn't
happening. I have tested the query and it works fine, so i'm guessing that I
need to write a macro or a set of VB code to tell the sub form to update
whenever a different value is selected in the combo box. I have already tried
to do thsi myself, but it is beyond my knowledge.

Could anyone help me with this?

Thanks,


Adrian Parsons
 
create a macro to 'requery' the control that needs to be updated add that
macro to the 'afterupdate' field in the combobox. You may only need to add
the control of the subform. Sometimes, when you get into subform and when
you want the entire form to refresh sometimes there's trouble (I'm no expert
either but have had the same question). The way you describe it however, if
you use the subform tool in the form design box which will automatically
create the appropriate parent/child relationship between the two forms using
the customerID.

Here are some articles I've used depending on the situation:
http://www.simply-access.com/UsingComboBoxFilterAnotherComboBox.html
http://support.microsoft.com/kb/135265
http://www.freevbcode.com/ShowCode.asp?ID=4668
 
Back
Top