Access.2007.VBA.Bibl..

(John Hannent) #1
FIGURE 12.3
The form used for inspecting orders and marking them for shipment.

The Select Orders for Shipping form (frmSelectOrdersForShipping) is a main form with a datasheet
subform. It is used to inspect orders that are in the correct time range for shipping and mark them
for shipping now. The main form displays fields from the orders, and the datasheet subform lists
the products on the selected order. On the main form, the “Ship Partial” checkbox is checked if a
partial order can be shipped, in case there is enough inventory to ship at least one product on the
order. The “Ready to Ship” checkbox indicates that the order is ready to ship, taking into account
factors over and above the available inventory.

To print shipping labels with extra information, I made a query
(qryNorthwindShippingLabels), based on qryNorthwindAll(a query that includes all
the linked Northwind data tables), containing all the information to print on the labels. Apart from
the shipping name and address, the query also includes the following fields:

n OrderDate
n RequiredDate (with a criterion of >Date()) And<DateAdd(“d”,30,Date())to
just include orders required from tomorrow to less than 30 days in the future
n DateShipped
n Supplier (an alias for CompanyName in tblSuppliers)
n ProductID
n ProductName
n OrderID
n NoCases (an alias for Quantity)

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf