Using access and visual basic

A company has been using a program written in VB using Access tables for sales order processing. The data model they have is as follows.

Customer customer No (PK), customer name, address etc
Order order No (PK), customer name (FK), date
Order_line (order No, stock No) compound PK, quantity
Stock stock No (PK). Price, description

The software uses a datagrid attached to the orderline table for data input. This has the effect of changing the sequence of the lines of the order as they are entered, as keys provide unique checks as well as changing the sequence of the data.
They wish to have the system modified to prevent this change in sequence but are interested in two other ideas. They currently hold entire orders in the warehouse until stock is available to meet each line of each order. They would like the computer to be used to keep track of the stock level and also permit partial delivey. This means that if a company wanted 10 widgets and only 6 were available, then those 6 should be sent and another 4 sent at a alater date. If only 3 were available at a later date, these should be sent and then the last 1 widget at a later date.
The other idea is that customers should be able to change their order before it has been printed on a picking list for the warehouse staff, but not after it has been printed.

The question is

What changes need to be made to the above database definition in order to solve all the problem?

Dani AI

Generated

Building on the thread: preserve a stable row identity for order lines, stop changing the original ordered quantity, and record shipments separately. That directly solves the datagrid re-ordering, enables partial deliveries, and lets orders remain editable until a picklist is printed. (A note about : subtracting shipped qty from the ordered amount is fragile — keep the original ordered quantity immutable and record shipments instead.)

Schema changes (key fields)

  • Give each order-line a surrogate primary key (e.g. OrderLineID AUTONUMBER) and a LinePosition integer used for display/order. Bind the grid ordered by LinePosition so insertion or key changes do not reorder rows.
  • Keep QtyOrdered (original), add QtyAllocated (reserved), and track shipments via QtyShipped derived from shipment records (or omit and compute sum of shipment lines).
  • Add PicklistPrinted (boolean) and PicklistPrintedDate to the Order header to control edit-locking.
  • Add new tables: Shipment and ShipmentLine to record each physical dispatch; optionally Allocation or InventoryTransaction to manage reservations and stock movements.

Example table queries and small DDL

SELECT * FROM OrderLine WHERE OrderNo=123 ORDER BY LinePosition;

Simple Access-style DDL sketches:

CREATE TABLE OrderLine (OrderLineID AUTOINCREMENT PRIMARY KEY, OrderNo LONG, LinePosition INTEGER, StockNo LONG, QtyOrdered LONG, QtyAllocated LONG DEFAULT 0);
CREATE TABLE Shipment (ShipmentID AUTOINCREMENT PRIMARY KEY, OrderNo LONG, ShipmentDate DATETIME);
CREATE TABLE ShipmentLine (ShipmentLineID AUTOINCREMENT PRIMARY KEY, ShipmentID LONG, OrderLineID LONG, QtyShipped LONG);

Process/workflow notes

  • Allocation: when stock arrives, allocate to open order-lines (FIFO by OrderDate/LinePosition) and update QtyAllocated or create Allocation rows.
  • Picklist: create a Picklist record (or set PicklistPrinted=true) and freeze edits at that point; generate Shipment/ShipmentLine entries when items are dispatched. Use application/form logic to prevent edits after PicklistPrinted.
  • Reordering in the grid: on insert assign LinePosition = MAX(LinePosition)+1; to move lines swap LinePosition values rather than renumbering everything.

Implementation cautions

  • Do not mutate the original QtyOrdered value as suggested by ; auditing and traceability require preserving original orders. Use separate shipment/allocation records for stock movements. In Access, enforce referential integrity, index OrderNo, LinePosition, and use form-level checks (BeforeUpdate) to block edits after picklist printing.

Recommended Answers

All 4 Replies

please help

i just want your views about it, and how you would answer it, which changes need to be made to the above database definition in order to solve all the problem?

I'm not sure about the entire question, but it would be simple to keep track of how many still need to be shipped. Just change the instances of order No so that it subtracts the amount sent, and rewrites it's value to new amount needed to send. I'm not sure about the rest of it though.

thank you very much, please if you think of anything else, please let me know, at least i have something to write about. once again thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.