Ok I have made the changes accordingly to what you said to the following:
Code:
Public Enum CustomerOrderStatusEnum
Quote_CustomerOrder = 0
Order_CustomerOrder = 1
QualityControl_CustomerOrder = 2
Invoiced_CustomerOrder = 3
Shipped_CustomerOrder = 4
Closed_CustomerOrder = 5
End Enum
Now my Code for the Order Form reads the following with no more errors:
Code:
Sub SetFormState(Optional fChangeFocus As Boolean = True)
If fChangeFocus Then Me.Customer_ID.SetFocus
Dim Status As CustomerOrderStatusEnum
Status = Nz(Me![Status ID], Quote_CustomerOrder)
TabCtlOrderData.Enabled = Not IsNull(Me![Customer ID])
Me.cmdCreateInvoice.Enabled = (Status = Order_CustomerOrder)
Me.cmdShipOrder.Enabled = (Status = QualityControl_CustomerOrder) Or (Status = Shipped_CustomerOrder)
Me.cmdDeleteOrder.Enabled = (Status = Quote_CustomerOrder) Or (Status = Invoiced_CustomerOrder)
Me.cmdCompleteOrder.Enabled = (Status <> Invoiced_CustomerOrder) Or (Status <> Closed_CustomerOrder)
Me.[Order Details_Page].Enabled = (Status = Quote_CustomerOrder) Or (Status = Order_CustomerOrder)
Me.[Shipping Information_Page].Enabled = (Status = Shipped_CustomerOrder)
Me.[Payment Information_Page].Enabled = (Status <> Closed_CustomerOrder)
Me.Customer_ID.Locked = (Status <> Quote_CustomerOrder)
Me.Employee_ID.Locked = (Status <> Quote_CustomerOrder)
Me.sbfOrderDetails.Locked = (Status <> Quote_CustomerOrder)
End Sub
But now the issue I have when I made those changes is that the links at the top to have the events run for "Create Quote/Invoice" and "Ship Order" are not able to click on at all. Can you show me where it went wrong in making those changes that could effect those links?
Here is the rest of the Code:
Code:
Private Sub cmdCreateInvoice_Click()
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
End If
End If
End Sub
Private Sub cmdShipOrder_Click()
If Not CustomerOrders.IsInvoiced(Nz(Me![Order ID], 0)) Then
MsgBoxOKOnly CannotShipNotInvoiced
ElseIf Not ValidateShipping() Then
MsgBoxOKOnly ShippingNotComplete
Else
Me![Status ID] = Shipped_CustomerOrder
If IsNull(Me![Shipped Date]) Then
Me![Shipped Date] = Date
End If
eh.TryToSaveRecord
SetFormState
End If
End Sub
TIA
Stephanie