T
TESA0_4
I have a subform where a user is required to roughly estimate cost
allocations between several possible work categories. eg if there are 3
applicable work categories they might allocate a percentage split of
10%:70%:20%. I have an unbound field that sums the percentage to assist the
user with correct summing of the percentage allocations to 100%. A button (on
the parent form) that allows the user to move to the next record is coded to
ensure the total percentage allocation on the current record equals 100%
before allowing a move to the next record.
If the cursor is moved straight from a Percent field on the datasheet
subform to the Next Record button the unbound PercentSum field has not
updated so the percentage check on the command button is invalid. Inserting a
Refresh in the command button code results in the unbound field being cleared
until after the full subroutine has run.
How can I force a valid check of the percentage sum on the current record
before moving to the next record?
Thanks in anticipation of any advice!!
My current code:
Me.Refresh
If tblPackageZonessubform.Form!PercentSum.Value <> 100 Then
MsgBox ("The Percentage split does not total 100")
Exit Sub
End If
DoCmd.GoToRecord , , acNext
allocations between several possible work categories. eg if there are 3
applicable work categories they might allocate a percentage split of
10%:70%:20%. I have an unbound field that sums the percentage to assist the
user with correct summing of the percentage allocations to 100%. A button (on
the parent form) that allows the user to move to the next record is coded to
ensure the total percentage allocation on the current record equals 100%
before allowing a move to the next record.
If the cursor is moved straight from a Percent field on the datasheet
subform to the Next Record button the unbound PercentSum field has not
updated so the percentage check on the command button is invalid. Inserting a
Refresh in the command button code results in the unbound field being cleared
until after the full subroutine has run.
How can I force a valid check of the percentage sum on the current record
before moving to the next record?
Thanks in anticipation of any advice!!
My current code:
Me.Refresh
If tblPackageZonessubform.Form!PercentSum.Value <> 100 Then
MsgBox ("The Percentage split does not total 100")
Exit Sub
End If
DoCmd.GoToRecord , , acNext