I have a table with a number of fields that update based on the initial and secondary value selections. The updated values work as designed, except when the form is closed, those fields are not updated in the underlying table.
Example:
Selection #1 = "CaseSize"
Selection #2 = "Shifts"
Code is as follows:
1
Private Sub CaseSize_AfterUpdate()
If CaseSize = "S" Then
TOT = 22
PcsPerBlk = 6300
Value = 1
Shift1PerStationUnitsPerHour = 6
ElseIf CaseSize = "F" Then
TOT = 25
PcsPerBlk = 3400
Value = 2
Shift1PerStationUnitsPerHour = 5
.....etc.
2
Private Sub Shifts_AfterUpdate()
If Shifts = 1 Then
Shift2PerStationUnitsPerHour = 0
Else: Shift2PerStationUnitsPerHour = RotaryShift1PerStationUnitsPerHour]
End If
End Sub
Everything is fine up to this point; the fields mentioned in the code update the corresponding table fields. After that it just doesn't work.
Next field is "Shift1PerStationUnitsPerShift" and the control source is "=([CastingShift1PerStationUnitsPerShift]*7)"
The math works but the table is never updated from this field or any others like it.
I have no idea what I've done wrong since I'm relatively new to all of this; I can generate a direct report from the form which displays all of the calculated values, but the table fields for these values are all equal to "0".
Example:
Selection #1 = "CaseSize"
Selection #2 = "Shifts"
Code is as follows:
1
Private Sub CaseSize_AfterUpdate()
If CaseSize = "S" Then
TOT = 22
PcsPerBlk = 6300
Value = 1
Shift1PerStationUnitsPerHour = 6
ElseIf CaseSize = "F" Then
TOT = 25
PcsPerBlk = 3400
Value = 2
Shift1PerStationUnitsPerHour = 5
.....etc.
2
Private Sub Shifts_AfterUpdate()
If Shifts = 1 Then
Shift2PerStationUnitsPerHour = 0
Else: Shift2PerStationUnitsPerHour = RotaryShift1PerStationUnitsPerHour]
End If
End Sub
Everything is fine up to this point; the fields mentioned in the code update the corresponding table fields. After that it just doesn't work.
Next field is "Shift1PerStationUnitsPerShift" and the control source is "=([CastingShift1PerStationUnitsPerShift]*7)"
The math works but the table is never updated from this field or any others like it.
I have no idea what I've done wrong since I'm relatively new to all of this; I can generate a direct report from the form which displays all of the calculated values, but the table fields for these values are all equal to "0".