Data entry - adding two new entry rows to a table via a form?

peskywinnets

Registered User.
Local time
Today, 11:49
Joined
Feb 4, 2014
Messages
587
Sorry if this is a lame question...

I want to manually add a customer sale to me database (it's all being done via an API presently), but having a mental block how I would add two twos (to reflect two items purchased) to a table from one form?

For example Mr Smith buys widget A & widget B, his details get added to the customer table (one row of data), the invoice table (one row of data) ......*but* the invoice items needs two new & separate rows (for widget A & widget B)....help?!!!!
 
For any form that directly interacts with data (add/edit/delete) you should base that form on 1 table. You want to interact with 3 tables, so you need at least 3 forms. I would actually use 4 forms, here's how:

User starts on frmCustomer (based on the Customer table) and adds the new customer's data.

At the bottom of frmCustomer there's subFrmInvoices (based on Invoices table). It shows all the invoices of a customer and allows user to enter a new one.

Besides each invoice in subFrmInvoices is a button labeled "Details", when clicked it opens frmInvoices (based on Invoices as well) to the specific Invoice it is next to on subFrmInvoices.

frmInvoices allows the user to update/edit the invoice data.

At the bottom of frmInvoices is subFrmItems (based on the InvoiceItems table--where you want the 2 rows to be added). Here is where you would add the items associated with that invoice.


When you need to add data to multiple tables that have many-to-many relationships (Customers -> Invoices ->Items) you use the Form/subForm method and just work from the top to the bottom of that relationship, giving each table in the middle of the relationship both a subForm to its parent and a main form which has a subform to its child.
 

Users who are viewing this thread

Back
Top Bottom