form/subform is causing duplicates

  • Thread starter Thread starter Carla
  • Start date Start date
C

Carla

Hello,

I am having a problem with a main form causing duplicates
in the underlying table.

I have a main form and a subform linked with CustID. THe
main form only has 1 combo box with a list of the CustId's
to choose from. Then the subform has all the order
informatin on it. So when I choose a CustId, instead of
just pulling up the id--the main table that runs the form
tries to add the CustId again. THerefore, I now have 2 of
the same CustID. So when I change to primary key, it
won't let me change the combo box at all, because the
table is trying to add another of the same CustID.

How can I keep this from happening?
THanks,
Carla
 
Carla,

If you're using the combo on the main form just for choosing, then it should
NOT be bound to the customers table. Open the form in design view, select
the combo, go to properties, tab Data, and clear the entry with the table
field name in property "Control Source".

Place the cursor a few lines lower, in property "Row source", and click on
the little button with the three dots (expression builder) on the RHS. You
will be taken to a query design window. Select your customers table, all the
fields that you need (presumably you would want to see at least the customer
name apart from the ID in the combo), click to close the window and answer
yes when prompted to save the changes to the SQL statement. At this point
you're done as far as the combo goes.

If you find you have lost the connection between the combo and the subform,
go to the subform's properties, tab Data, and fix the Link Child Fields and
Link Master Fields properties so they both point to the right fields.

HTH,

Nikos
 
Back
Top