Access.2007.VBA.Bibl..

(John Hannent) #1
For orders with ShipPartial unchecked, can’t ship the order because one product has inadequate
inventory:

strTitle = “Inadequate inventory”
strPrompt = “Only “ & lngCasesInStock _
& “ cases in inventory; can’t fill Order ID “ _
& lngOrderID & “ for “ & strProductName
MsgBox strPrompt, vbExclamation, strTitle
GoTo NextOrder
ElseIf blnShipPartial = True Then

For orders with ShipPartial checked, can’t ship this product on the order:

strTitle = “Inadequate inventory”
strPrompt = “Only “ & lngCasesInStock _
& “ cases in inventory; can’t fill “ _
& strProductName & “ item on “ _
& “Order ID “ & lngOrderID
MsgBox strPrompt, vbExclamation, strTitle

Figure 12.4 shows a typical “Inadequate inventory” message when there isn’t enough inventory to
fill a product line item on an order with ShipPartial checked.

FIGURE 12.4
A message indicating that there is inadequate inventory to ship a product item on an order.

Check the next product on the order:

GoTo NextProduct
End If
Else

There is enough inventory to ship this product; create a new labels document for this set of labels
from the template:

Set doc = _
appWord.Documents.Add(Template:= _
strTemplateNameAndPath, _
documenttype:=wdNewBlankDocument, _
Visible:=True)
doc.Activate

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf