If statement in a calculated field problem

Steve67

Registered User.
Local time
Today, 11:52
Joined
Oct 2, 2007
Messages
21
This seems to be something easy to do, but I have yet to be able to get it working right. I have a field called Running Total that automatically updates as it calculates numbers being put into other fields. When the Running Total is >= to a certain number I would like a message box to automatic come up. Writing the IF statement I don't think is the problem I am having, but not sure which Form event to put it in. I thought AfterUpdate would work, but from what I understand you can't use AfterUpdate event in a calculated field. I tried it anyway, but it didn't work. Maybe I am taking the wrong approach

The if statement I have is the following:

If (Running_Total >= PmCycle) Then
MsgBox "Time for tool to be PM'd"
End If

Thanks for your help

Steve
 
>>>automatically updates as it calculates numbers being put into other fields<<<

I suspect you need to add some code to the after update property of these other fields.
 
>>>automatically updates as it calculates numbers being put into other fields<<<

I suspect you need to add some code to the after update property of these other fields.

I was thinking that too, but hope there is an easier way since that seems to have to write a lot of extra code for one simple task.
 
Have you tried using the form's On Current event?
 
How about this:

Code:
If (Me!Running_Total >= Me!PmCycle) Then
   MsgBox "Time for tool to be PM'd"
End If
 
How about this:

Code:
If (Me!Running_Total >= Me!PmCycle) Then
   MsgBox "Time for tool to be PM'd"
End If

If I put that in the On Current event on the Form, once I switch records the message box will come up, but need to have the message box come up as soon as the Running Total is >= the Pm Cycle total. Thats where I am running into the problem.
 
The on change event of the running total?
 
Steve, can you please post your solution so the rest of us can benefit? Or is it the code you posted above?
 
Steve, can you please post your solution so the rest of us can benefit? Or is it the code you posted above?

I kind of took the long way about this. What I ended up doing is putting this If statement:

If (Running_Total >= PmCycle) Then
MsgBox "Time for tool to be PM'd"
End If

In the OnExit event on each data field. I probable could have made a general statement, but I am just learning VBA and this worked for what I needed to do.
 
How would I make it display a button or a textbox. instead of a message box
 

Users who are viewing this thread

Back
Top Bottom