Domanda

I am creating a sales invoicing program which has an access database as a backend for storing product and customer information so that the user can choose a customer from a dropdown, select products from dropdowns, etc. What I'm struggling with at the moment is deciding what is the best way of taking input from the user when it comes to products quantity, unit price and total price. Should I just use a bunch of rows of textboxes? But then if the user runs out of rows, I'm screwed. Another option would be to use datagrid view, but then that means no comboboxes and auto-completion resulting in slower input. Keeping in mind that an invoice would obviously need to be stored and then recalled later, what is the best way to go about doing this?

BTW keep in mind I'm quite inexperienced (as you can probably tell by now) with coding in VB so try to keep it simple so I can follow through and understand.

Much thanks for your time and help.

P.S. Here's a link to my relational DB model - a screenshot from access.

Database relationship diagram - MS Access

È stato utile?

Soluzione

Your relational design is fine, but what you are looking for is a Main-form sub-form setup.

Per your diagram: 1st Create an invoice form that contains just the information in your invoice table. I would use a combo box to populate the customerID from your customer table.

Next, create a second form for your line items table, and it should be set to display as "continuous forms" so that it will show multiple line items. Once again, use a combo box to enter productIDs from your Product table.

Finally, go back to your Invoice form and use the subform control to add the line item form to it, linking it with the InvoiceID field.

This is really a common setup, there are tons of examples. If you can get a copy of the venerable Northwind.mdb (tons of places it can be found on the internet), you can see how it is done.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top