Wrong Rows being Updated

G

Guest

Here's the senerio...

Open form and Initial values that appear...

cust 1 (main form)

order1 (subform)
order2(subform)

If I select a different customer..

cust 2(main form)
order 3(subform)
order 4(subform)

If I look at the table the cust1 order1 gets changed to cust2

I hope this helps explaining my situation
 
W

Wayne Morgan

The customer information and order information should be in two different
tables linked by the unique CustomerID field. You would then use these
tables or queries based on these tables to feed each form. In the properties
for the subform control on the main form you would set the master/child link
fields. These should be the same as the link above, the CustomerID field for
each form. This will cause the forms to synchronize and the subform will
show the orders for the customer displayed in the main form. This will
happen as you move from one record to the next (i.e. from one customer to
the next) in the main form.

However, rather than moving between records on the main form to go to the
next customer's record, it sounds as if you've placed a combo box on the
main form and are changing the customer for the current record.
 
T

Troy

I'm guessing that you have a list of Customers in a dropdown or another
control on the Main form. Since you have the main form bound, and you are on
Record 1, changing the customer for Record 1 applies to Record 1.

If you want to simply requery the subforms based on customer selection you
can try this:

1. Unbind the Main form. Remove it's Recordsource.
2. If you are not already using a combo box to display a list of customers,
add one and set it's RowSource to a query that returns customers.
3. Name that combo "cboCustomers"
4. In the subform control, set the Link Master Field to cboCustomers
5. In the subform control, set the Link Child Field to FK_Customers

NOTE: Access will not let you select these fields automatically because
unbound forms cannot link like this. However, if you manually type in the
correct names, this will work fine.

If you are trying to create a Customers to Orders (1 to Many) relationship,
that may not be the correct methodology to use. Northwind uses a good
example of how to process orders and order details.

--
Troy

Troy Munford
Development Operations Manager
FMS, Inc.
www.fmsinc.com


Here's the senerio...

Open form and Initial values that appear...

cust 1 (main form)

order1 (subform)
order2(subform)

If I select a different customer..

cust 2(main form)
order 3(subform)
order 4(subform)

If I look at the table the cust1 order1 gets changed to cust2

I hope this helps explaining my situation
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top