strSaveNameAndPath = strDocsPath & strSaveName
Debug.Print “Save name: “ & strSaveNameOn Error Resume NextCheck for the existence of a file with this name, and delete it if found:
Set fil = fso.GetFile(strSaveNameAndPath)
If Not fil Is Nothing Then
Kill strSaveNameAndPath
End IfOn Error GoTo ErrorHandler
doc.SaveAs FileName:=strSaveNameAndPathUpdate the progress meter:
Application.SysCmd acSysCmdUpdateMeter, lngSetUpdate the ReadyToShip field in tblOrders to False:
DoCmd.SetWarnings False
strSQL = “UPDATE tblOrders SET “ _
& “tblOrders.ReadyToShip = False “ _
& “WHERE OrderID = “ & lngOrderID
Debug.Print “SQL string: “ & strSQL
DoCmd.RunSQL strSQLSubtract the amount of product shipped from the in stock amount in tblProducts:
lngSubtract = lngCasesInStock - lngNoCases
strSQL = “UPDATE tblProducts SET “ _
& “tblProducts.UnitsInStock = “ _
& lngSubtract & “ WHERE ProductID = “ _
& lngProductID
Debug.Print “SQL string: “ & strSQL
DoCmd.RunSQL strSQLIn tblOrderDetails, set QuantityShipped to QuantityOrdered, and DateShipped to today’s date:
strSQL = “UPDATE tblOrderDetails SET “ _
& “tblOrderDetails.QuantityShipped = “ _
& “[QuantityOrdered], “ _
& “tblOrderDetails.DateShipped = Date() “ _
& “WHERE tblOrderDetails.OrderID = “ _
& lngOrderID _
& “ And tblOrderDetails.ProductID = “ _
& lngProductID & “;”
Debug.Print “SQL string: “ & strSQL
DoCmd.RunSQL strSQLGoing Beyond the Basics 12