in the northwind db vb code they have something for if a productorder exists, i would need help editing this to work for me tho.
Code:
Function Exists(PurchaseOrderID As Long) As Boolean
Exists = Not IsNull(DLookupWrapper("[Purchase Order ID]", "Purchase Orders", "[Purchase Order ID]=" & PurchaseOrderID))
End Function
and i see it being used here
Code:
Function PurchaseOrderIsValid() As Boolean
Dim PurchaseOrderID As Long
PurchaseOrderID = Nz(Me![Purchase Order ID], 0)
Select Case Me![Status ID]
Case New_PurchaseOrder
If Not PurchaseContainsLineItems() Then
MsgBoxOKOnly PurchaseHasNoLineItems
If MsgBoxYesNo(CancelOrderPrompt) Then
If PurchaseOrders.Exists(PurchaseOrderID) Then
If Not PurchaseOrders.Delete(PurchaseOrderID) Then
Exit Function
End If
End If
End If
End If
Case Submitted_PurchaseOrder
Case Approved_PurchaseOrder
Case Closed_PurchaseOrder
End Select
PurchaseOrderIsValid = True
End Function
the first is in a module, the second is in the purchase order details forms code