Dim OrderID As Long Dim InvoiceID As Long OrderID = Nz(Me![Order ID], 0) ' Gracefully exit if invoice already created If CustomerOrders.IsInvoiced(OrderID) Then If MsgBoxYesNo(OrderAlreadyInvoiced) Then CustomerOrders.PrintInvoice OrderID End If ElseIf ValidateOrder(Invoiced_CustomerOrder) Then ' Create Invoice Record If CustomerOrders.CreateInvoice(OrderID, 0, InvoiceID) Then ' Mark all Order Items Invoiced ' Need to change Inventory Status to SOLD from HOLD Dim rsw As New RecordsetWrapper With rsw.GetRecordsetClone(Me.sbfOrderDetails.Form.Recordset) While Not .EOF If Not IsNull(![Inventory ID]) And ![Status ID] = OnHold_OrderItemStatus Then rsw.Edit ![Status ID] = Invoiced_OrderItemStatus rsw.Update Inventory.HoldToSold ![Inventory ID] End If rsw.MoveNext Wend End With ' Print the Invoice CustomerOrders.PrintInvoice OrderID SetFormState
23 People are following this question.