Inma said:
Hello,
Perhaps I'm not seeing the trees in a forest but I'm totally stumped.
I've two simple tables, CUSTOMERS and EXPENSES. The latter has
CUSTOMER_ID as a link to the first table (CUSTOMERS.CUSTOMER_ID <->
EXPENSES.CUSTOMER_ID).
I need to create a form to input data in the EXPENSES table selecting
the customer name from CUSTOMERS.
How would I go by?
Multiple methods are available, but here is what I would do...
Create a form bound to the Customers table displaying everything you want to see
about the customer. Then add an unbound ComboBox labelled "Go To...". The
RowSource of that ComboBox should include CUSTOMER_ID and CUSTOMER_NAME with
CUSTOMER_ID being the bound column (hidden if you like). In the AfterUpdate
event of the ComboBox have code...
Me.Filter = "CUSTOMER_ID = " & Me!GoToComboBoxName
Me.FilterOn = True
You now have a simple Customer form with an easy ability to view any one
customer by using the ComboBox.
Now create a continuous view form bound to the Expenses table and format how you
want it to look. When finished you can open the Customer form in design view
and drag the expenses form from the db window onto the customer form and Access
will automatically add the expenses form as a subform.
It is important that the linking field CUSTOMER_ID be entered into the
MasterLink and ChildLink properties of the subform. If you have these
relationships defined in the relationships window then Access should insert the
property values automatically (check them anyway).
Now when you move from customer to customer with the ComboBox you will see each
customers expenses in the subform and can make edits and insertions.