Combo box seems to be creating new records by itself

^Nightwing^

Registered User.
Local time
Today, 10:18
Joined
Sep 20, 2004
Messages
10
I have a combo box on one form that allows you to select from a list of names that come from a query of a table of people. However, whenever I change the value in a box, it causes it to create a new record in this table with the same name. Am I doing something wrong here?

www.srcf.ucam.org/~cmf40/HID.mdb if anyone wants to take a look.
 
Cheers for your help, it's on the Data Entry/Groups form, adding new records to the Investors form.
 
Nightwing,

Changes I made to your database to fix the problem of the doubling-up of investors.

1. Changed the group ID to Autonumber in the Group/Capital History Junction table. (because it is very awkward to have to think about an ID every time you create a new group.
2. Enforced referential integrity with the Capital History table.

The mistake you had made with your combobox adding records to the investors, was that you had used the wrong field for the combobox; instead of binding to the InvestorID of the Group table you had the combobox bound to the Name field in the Investor table’s ID. That is why it kept adding another record to the investor table, instead of a new reference of the same in the Group table. Compare my version to your existing database.

Now if you want to add a new investor in the combobox, you may use the NotInList event to prompt the user for an addition. If you don’t know how to do that, I will let you have the code.

Pierre.
 

Attachments

Pierre is my saviour again ;).

However if I autonumber the Group ID field, then each name is given a different number in this field, so it becomes one-to-one, which won't work. If the problem is selecting the name, then I guess I will just have to have the Investor ID selected instead.
 

Users who are viewing this thread

Back
Top Bottom