G
Guest
Hi,
I have a data entry form where among other fields, a field 'amount' needs
to be validated before the entry. Several different amounts (i.e. data entry) are made for a particular accountid. The sum of these amounts should be less than that of the total award amount i.e. I need to make sure for an amount entered for a particular accountid in the data entry screen, the sum of all the amounts for that particular accountid (including the present one)should be less than the reward
amount for that case. It is noted here that the accountid in the data entry screen gets chosen form a list in a combobox namely cboSelectBlockGrant.
I am trying to achieve this in the following code with BeforeUpdate event.
If (Me.Amount + DSum("[Amount]", "tblAccounts", "[AccounttID] = Me.cboSelectBlockGrant ")) > Me.AwardAmount Then
MsgBox "You cannot have the sum of accounts greater than the award amount"
However, this seems not to be working. Any help is appreciated.
I have a data entry form where among other fields, a field 'amount' needs
to be validated before the entry. Several different amounts (i.e. data entry) are made for a particular accountid. The sum of these amounts should be less than that of the total award amount i.e. I need to make sure for an amount entered for a particular accountid in the data entry screen, the sum of all the amounts for that particular accountid (including the present one)should be less than the reward
amount for that case. It is noted here that the accountid in the data entry screen gets chosen form a list in a combobox namely cboSelectBlockGrant.
I am trying to achieve this in the following code with BeforeUpdate event.
If (Me.Amount + DSum("[Amount]", "tblAccounts", "[AccounttID] = Me.cboSelectBlockGrant ")) > Me.AwardAmount Then
MsgBox "You cannot have the sum of accounts greater than the award amount"
However, this seems not to be working. Any help is appreciated.