Restrick "closing order" Button being pressed if orders still outstanding

rainbows

Registered User.
Local time
Today, 04:27
Joined
Apr 21, 2017
Messages
428
below is my order and order details screen. there are 3 products required for this order. i have discovered that the "order shipped button is sometime being pressed before all 3 products have been shipped. these could be shipped at different dates when the order shipped buttom is pressed the order is not visable anymore

how can i get it that if the y try to press the order shipped button it sends a message telling them all the products have not been shipped

thanks
steve



1708077679164.png
 
Use a dcount() on the order lines where Shipped = 0 and OrderNo = YourOrderNo
if it's more than 0 then all the order lines haven't shipped?
 
I would also count what I send.

The question would still be whether I make the sending dependent on the count or just provide information afterwards.

You can also bring existing records that are no longer visible due to a given filtering back into the foreground by changing the filtering.
 
well, the subform should set it automatically on the main form:

on subform current event:

Code:
private sub Form_current()
    dim rec_count as long, ship_count as long, bolShipComplete as boolean
    with me.recordsetclone
        if not (.bof and .eof) then
            .movelast
            .movefirst
            rec_count = .recordcount
        end if
        do until .eof
            ship_count = ship_count + !shipped
            .movenext
        loop
    end with
ship_count = abs(ship_count)
bolShipcomplete = (rec_count = ship_count) and (rec_count > 0)
if me!parent![order shipped] <> bolShipcomplete then
     me!parent![order shipped]  = bolShipComplete
    me!parent.dirty = false
end if
 
Last edited:
Apart from Pat's remark, I would be disabling the button until everything was shipped?
 
Managed to look at this again , this is working good ok now , had to do a couple of changes albeit guess what i was doing.
thank you for all your help , as it was said much easier that it closes the order automatically

steve

Code:
Me.Parent.Refresh
    Dim rec_count As Long, ship_count As Long, bolShipComplete As Boolean
    With Me.RecordsetClone
        If Not (.BOF And .EOF) Then
            .MoveLast
            .MoveFirst
            rec_count = .RecordCount
        End If
        Do Until .EOF
            ship_count = ship_count + !shipped
            .MoveNext
        Loop
    End With
ship_count = Abs(ship_count)

bolShipComplete = (rec_count = ship_count) And (rec_count > 0)
If Me.Parent![Ordershipped] <> bolShipComplete Then
     Me.Parent![Ordershipped] = bolShipComplete
 
    Me.Parent.Dirty = False
End If

End Sub
 

Users who are viewing this thread

Back
Top Bottom