Over Budget Alert

DanG

Registered User.
Local time
Today, 12:14
Joined
Nov 4, 2004
Messages
477
I have a Budget DB that when the total remaining budget amount is <0 the back color if that box turns red.
I am at the stage in VBA where I know enough to be dangerouse but not yet productive.
The form is in continuous view to record each budget expense by date and the forms footer then has totals of budget amount, budget spent and budget remaining. It is after a new detail is entered that I want the budget remaining to alert the user. (in this case I am using "Lodging" as an example field)

So far I have an afteupdate event in the "Lodging" field in VBA to refresh the entire form so the totals will change while the user is still in the record.
Then I have been trying to use an "on change" event for the remaining budget box using the following VBA:

(Text156 is the Budget Remaining Field)

Private Sub Text156_Change()
If Forms![detail subform]!Text156 < 0 Then
Forms![detail subform]!Text156.BackColor = vbRed
Else
Forms![detail subform]!Text156.BackColor = vbWhite
End If
End Sub

There are areas that I am not so clear on...
1.When do you need to define the data type between the () as in "Sub Text156_Change()"?
2. In Forms![detail subform]!Text156 I am not sure when to use a bang or a dot as I did before the "Text156" part

Thank you for any help you can offer.
 
Dan,

You can use "Me.ReCalc" to recalculate your form.

You should not use the OnChange event for the textbox. It will fire on
EACH character that the user types in and give undesireable results.
Use the BeforeUpdate or AfterUpdate event instead.

Wayne
 
Yeah, I was getting some pretty funny things going on with the on change thing.
I think my code was good, I just think I have to find the right event like you said.

Thanks Wayne
 

Users who are viewing this thread

Back
Top Bottom