View Full Version : Data Entry form based on 2 tables


wilderem
03-15-2002, 09:32 AM
I have a data entry form (based on Projects Table) used to add new projects to our database. One of the fields on the form is a combo box that looks up records in the Client table. There is a one-to-many relationshipe between the Client table and the Projects table. All data is saved to the Projects table. I want users to be able to pick from the list in the combo box, or type in a new client, if necessary. My problem is that the new client gets added to the Projects table, but not the Clients table - I can't enforce referetial integrity w/cascade updates, because the Client table is the "one" side of the relationship. How do I get the new client added to the Client table?

Fuga
03-15-2002, 09:42 AM
Canīt you create an "add form" based on the client table (with a combobox if you want)and then use the project tbl as a subform, where the client fields are linked?

Hope I understood the question.

Fuga.

wilderem
03-15-2002, 10:58 AM
Fuga,

When I do as you suggest, it works fine for adding a new client, however, if I pick an existing client off the list, I get a error message stating that Access cannot save the record since it will create duplicate entries in a primary key (in the client table).

Any other suggestions?

David R
03-15-2002, 11:49 AM
You need to put code behind the NotInList event to trap for new clients, and then open your other form from that.

Check out this article on Microsoft's Support pages: Q197526

HTH,
David R