I'm wondering if anyone has any idea how I can speed this form up. I have similar forms that don't calculate as much but are much faster when updating the date.
Basically, I have a make table query that pulls all units due to be delivered between a certain time period, that are a specific priority and we input how many days we want to push the delivery date back.
A form opens that shows the Job Code, Run, Door Style, Special Color, Lot Delivery Date, W/O Due Date, W/O Start Date and a Change check box. If the Change check box is selected the W/O Due Date moves back however many days entered. Based on the new W/O Due Date and whether or not a Raised Panel door or Special Color was selected the WOSD resets as well.
Here is the code I have used. It takes a little over a minute to update 1 line and we may need to move several lines. After all the units needed to move are selected, an update query is run updating the information in the actual tables used in the make table query.
Private Sub Change_Exit(Cancel As Integer)
If Me.Change = True Then
Call UpdateWODDChange
Call UpdateWOSDChange
End If
End Sub
Private Sub Form_Close()
DoCmd.OpenQuery "qryUpdateWODDPriorityChange"
DoCmd.OpenForm "frmMenu"
End Sub
Private Sub UpdateWODDChange()
Dim intNumDays As Integer
intNumDays = Forms!frmUpdateWODDbyPriority.Form.PushForwardDays
Me.WODD = AddWorkdays(Me.LotDelDate, intNumDays)
End Sub
Private Sub UpdateWOSDChange()
Dim AddColor As Boolean
Dim intNumDays As Integer
If Not (Forms!frmUpdateWODDbyPriority.Form.SpecialColor = 0) Then
AddColor = True
Else
AddColor = False
End If
Select Case Me.DoorStyle
Case "Eagle", "H/E", "F/E", "RP-9", "RP-22", "RP-23"
If AddColor Then
intNumDays = 7
Else
intNumDays = 6
End If
Case Else
If AddColor Then
intNumDays = 7
Else
intNumDays = 5
End If
End Select
Me.WOSD = MinusWorkdays(Me.WODD, intNumDays)
End Sub
Basically, I have a make table query that pulls all units due to be delivered between a certain time period, that are a specific priority and we input how many days we want to push the delivery date back.
A form opens that shows the Job Code, Run, Door Style, Special Color, Lot Delivery Date, W/O Due Date, W/O Start Date and a Change check box. If the Change check box is selected the W/O Due Date moves back however many days entered. Based on the new W/O Due Date and whether or not a Raised Panel door or Special Color was selected the WOSD resets as well.
Here is the code I have used. It takes a little over a minute to update 1 line and we may need to move several lines. After all the units needed to move are selected, an update query is run updating the information in the actual tables used in the make table query.
Private Sub Change_Exit(Cancel As Integer)
If Me.Change = True Then
Call UpdateWODDChange
Call UpdateWOSDChange
End If
End Sub
Private Sub Form_Close()
DoCmd.OpenQuery "qryUpdateWODDPriorityChange"
DoCmd.OpenForm "frmMenu"
End Sub
Private Sub UpdateWODDChange()
Dim intNumDays As Integer
intNumDays = Forms!frmUpdateWODDbyPriority.Form.PushForwardDays
Me.WODD = AddWorkdays(Me.LotDelDate, intNumDays)
End Sub
Private Sub UpdateWOSDChange()
Dim AddColor As Boolean
Dim intNumDays As Integer
If Not (Forms!frmUpdateWODDbyPriority.Form.SpecialColor = 0) Then
AddColor = True
Else
AddColor = False
End If
Select Case Me.DoorStyle
Case "Eagle", "H/E", "F/E", "RP-9", "RP-22", "RP-23"
If AddColor Then
intNumDays = 7
Else
intNumDays = 6
End If
Case Else
If AddColor Then
intNumDays = 7
Else
intNumDays = 5
End If
End Select
Me.WOSD = MinusWorkdays(Me.WODD, intNumDays)
End Sub