I have a form with a tabcontrol which has a number of pages. I want to check
the value of a calculated control on one page with a calculated control on
another page. The calculated control (txtTotNbrClien ts) on page 3 is the sum
of these controls on that page
([txtClientsdomfa csole] + [txtClientsdomid sole] + [txtClientsexpso le] +
[txtClientsimpso le] + [txtClientsdomfa cpart] + [txtClientsdomid part] +
[txtClientsexppa rt] + [txtClientsimppa rt])
The calculated control on page 4 (txtClientsTot) is the sum of these
controls on that page
([txtClients0] + [txtClients500] + [txtClients1000] + [txtClients5000] +
[txtClients10000] + [txtClients50000] + [txtClients10000 0])
I tried using the calculated control names in my code but that didn't work
so I assumed I would have to do the calculation again in the code. So here
is my code which I have tried in the BeforeUpdate and AfterUpdate property
of txtClientsTot
If ([txtClients0] + [txtClients500] + [txtClients1000] + [txtClients5000] +
[txtClients10000] + [txtClients50000] + [txtClients10000 0]) <>
([txtClientsdomfa csole] + [txtClientsdomid sole] + [txtClientsexpso le] +
[txtClientsimpso le] + [txtClientsdomfa cpart] + [txtClientsdomid part] +
[txtClientsexppa rt] + [txtClientsimppa rt]) Then
If MsgBox("Total does not agree with Total Number of Clients on Page 3" &
vbCrLf & "It should be " & [txtTotNbrClient s] & " - Do you want to accept
the error?", vbYesNo, "Calculatio n Error") = vbNo Then
Cancel = True
End If
End If
I should get a message box if the two totals don't agree but I don't.
Anyone help here?
TIA
Tony