I am having some design questions about my Inventory Database. Mainly about the Status of the Order and Criteria to be set.
Here is my code for the Post as Paid command button that allows you to view/print Invoice if criteria is met.
My questions are;
1. Do I lock the required fields after a Invoice has been Posted as Paid?
2. Create a command button to ask why they need to change it and what they need to change?
3. What else should I be aware of that I may be missing?
Private Sub CreateNewOrder_Click() 'Purpose,To check for criteria before allowing Post as Paid
Dim AddItemsAsInventorymsgbox As String 'Checks For Posting Criteria,Allows Viewing Invoice
If [OrderStatus] = "Posted" Then
AddItemsAsInventorymsgbox = MsgBox("Order Has Already Been Posted,Do You Need To View Invoice?", vbInformation + vbYesNo, "ProductDetails")
If (AddItemsAsInventorymsgbox = vbYes) Then
DoCmd.OpenReport "CustomerInvoice", acViewPreview
Else
End If
End If
Exit Sub
If txtamountdue > 0 Or txtbalance > 0 Then 'Asks if this will be a Partial Invoice,set Label on Report to Visible
PartialInvoicemsgbox = MsgBox("Will This Reference a Partial Invoice?", vbInformation + vbYesNo, "OrderDetails")
If (PartialInvoicemsgbox = vbYes) Then
lblonhold.Visible = True
DoCmd.OpenReport "CustomerInvoice", acViewPreview
lblpartialinvoice.Visible = True
Else
lblonhold.Visible = False
lblpartialinvoice.Visible = False
Exit Sub
End If
End If
DoCmd.SetWarnings False
If txtamountdue = 0 And txtbalance = 0 Then
End If
If txtamountdue > 0 And txtbalance > 0 Then
MsgBox "You Have a Balance or Amount Due Pending"
Exit Sub
If DCount("*", "qryAllRecordsStatus") > 0 Then
MsgBox "You Have Items Not Yet Posted"
Exit Sub
End If
If IsNull([CustomerID]) Then
MsgBox "A Customer is Required"
ElseIf IsNull([EmployeeID]) Then
MsgBox "A Employee is Required"
ElseIf IsNull([ShippingMethodID]) Then
MsgBox " A Shipping Method is Required"
ElseIf IsNull([OrderedBy]) Then
MsgBox "Employee Who is Ordereding is Required"
ElseIf IsNull([OrderDate]) Then
MsgBox "A Order Date is Required"
ElseIf IsNull([PurchaseOrderNumber]) Then
MsgBox "A Purchase Order Number is Required"
ElseIf IsNull([SubmittedBy]) Then
MsgBox "Person Submitting Order is Required"
ElseIf IsNull([ClosedBy]) Then
MsgBox "Person Who is Closing Order is Required"
ElseIf IsNull([ShipDate]) Then
MsgBox "A Shipping Date is Required"
ElseIf IsNull([SubmittedDte]) Then
MsgBox "A Submitted Date is Required"
ElseIf IsNull([ClosedDte]) Then
MsgBox "A Closed Date is Required"
End If
Else: lblpaid.Visible = True 'Displays Paid Label
[OrderStatus] = "Posted" 'Sets Order Status To Posted as in Paid in Full
Me.CreateNewOrder.Enabled = False
If Me.Dirty Then Me.Dirty = False 'Forces a Save Record.
DoCmd.OpenReport "CustomerInvoice", acViewPreview
DoCmd.SetWarnings True
End If
End Sub