Ask for confirmation to set all ReorderAmount values to zero, and add the amount ordered to
UnitsOnOrder:
strTitle = “Confirmation”
strPrompt = “Clear reorder and on order amounts?”
intReturn = MsgBox(strPrompt, vbQuestion + vbYesNo, _
strTitle)
If intReturn = vbYes Then
DoCmd.SetWarnings False
strSQL = “UPDATE qryProductsToReorder SET “ _
& “qryProductsToReorder.UnitsOnOrder = “ _
& “[UnitsOnOrder]+[ReorderAmount], “ _
& “qryProductsToReorder.ReorderAmount = 0;”
Debug.Print “SQL string: “ & strSQL
DoCmd.RunSQL strSQL
End If
Display the Outlook email message with the PDF or snapshot attachment:
msg.Display
DoCmd.Close acForm, Me.Name
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox “Error No: “ & Err.Number _
& “; Description: “ & Err.Description
Resume ErrorHandlerExit
End Sub
Summary ..........................................................................................................................
The techniques described in this chapter should give you more ideas about how you can use Word,
Excel, and Outlook to expand the functionality of Access databases, using VBA code to examine
data and make decisions about what data should be exported, and to format the Office documents
filled with Access data.
Part II Writing VBA Code to Exchange Data between Office Components