- Joined
- Feb 18, 2008
- Messages
- 2
- Reaction score
- 0
Hi guys.
The database I am trying to construct at work monitors when order items are packed.
I have a main form which shows the overall packed date (sDatePacked) and a subform which shows the order lines and their individual packed dates (oDatePacked). They are linked through the order number.
I have a button on the subform that marks the field (oDatePacked) with todays date as and when each order line gets packed.
I have the following code in an unbound box (called maxAllPackedDate) in the subform.
=IIf(Count(*)>0 And Count(*)-Count([oDatePacked])=0,Max([oDatePacked]),"")
If all of the order lines are packed, it shows the (max) last date that a line was packed. If one or more of the order lines are not packed it shows nothing.
The trouble is I want to store this (max) date on the main form as I pack the items. I know how to display it on the main form, but not how to store it.
I thought about using the following code on the forms exit…
DoCmd.Requery ""
Call Pause(1#)
Forms!frmPackingSummaryVIP![sDatePacked] = Forms!frmPackingSummaryVIP!frmPackingSummaryOrders.Form![maxAllPackedDate]
Call Pause(0.5)
DoCmd.Close acForm, "frmPackingSummaryVIP"
The problem is if network traffic is a bit heavy the refresh doesn’t happen quick enough and the subform total isn’t calculated in time. It also seems a very messy ‘hit-and-miss’ way of doing things. Can anyone help me please ?
Is there an easier way to store a subforms subtotal by way of a query perhaps ?
Please keep it reasonably simple as I’m a bit of a noob ! LOL
The database I am trying to construct at work monitors when order items are packed.
I have a main form which shows the overall packed date (sDatePacked) and a subform which shows the order lines and their individual packed dates (oDatePacked). They are linked through the order number.
I have a button on the subform that marks the field (oDatePacked) with todays date as and when each order line gets packed.
I have the following code in an unbound box (called maxAllPackedDate) in the subform.
=IIf(Count(*)>0 And Count(*)-Count([oDatePacked])=0,Max([oDatePacked]),"")
If all of the order lines are packed, it shows the (max) last date that a line was packed. If one or more of the order lines are not packed it shows nothing.
The trouble is I want to store this (max) date on the main form as I pack the items. I know how to display it on the main form, but not how to store it.
I thought about using the following code on the forms exit…
DoCmd.Requery ""
Call Pause(1#)
Forms!frmPackingSummaryVIP![sDatePacked] = Forms!frmPackingSummaryVIP!frmPackingSummaryOrders.Form![maxAllPackedDate]
Call Pause(0.5)
DoCmd.Close acForm, "frmPackingSummaryVIP"
The problem is if network traffic is a bit heavy the refresh doesn’t happen quick enough and the subform total isn’t calculated in time. It also seems a very messy ‘hit-and-miss’ way of doing things. Can anyone help me please ?
Is there an easier way to store a subforms subtotal by way of a query perhaps ?
Please keep it reasonably simple as I’m a bit of a noob ! LOL