Calculation Help

  • Thread starter Thread starter Heidi
  • Start date Start date
H

Heidi

Hi there,

Here's what I am trying to do:
I have two fields on a form. One for Estimated $ and one
for Acutal $. I would like to do this: If the dollar
amount in the Actual $ field ends up being 10% more than
the Estimated dollar amount field, I would like a "flag"
of some sort (like a label on the screen) to pop up, and I
would also like to use the SendObject macro to send an
email to a person letting them know of the discrepency. I
just can't seem to figure out the calculation to do so.

Any help would be very much appreciated!
Thanks!!!!
 
Heidi,
Off the top of my head, something like this in an event:

If [Actual] > ([Estimated]*1.1) Then
MsgBox "Too much over. Sending an e-mail message."
Dim strText as String
strText = "You are over the estimated amount by $ " & [Actual] -
[Estimated]
DoCmd.SendObject etc.
End If

** See the SendObject method in Access Help for the necessary arguments.**

Then write strText in as the Message Text argument.

Which event?
Depends on what you are doing.
If you are entering the [Actual] data, you can use the [Actual] control's
AfterUpdate event.
If you are entering the [Estimated] data, you can use the [Estimated]
control's AfterUpdate event.

If you are just displaying the data without entering any, use the Form's
Current event.
But you'll then need some method to determine whether the email has been
previously sent,
as the message and email will be sent everytime this record is displayed.
 
Back
Top