Focus Event

  • Thread starter Thread starter Scafidel
  • Start date Start date
S

Scafidel

I can't seem to get this to work. In the code below, ActualBonus is a
calculation and TotalBonus is entered by the user; both are text fields. I
would like the message to appear after entering the data, but it doesn't seem
to work. I can substitute the value of either [ActualBonus] or (a correct)
[TotalBonus] and it works.
Thanks

Private Sub TotalBonus_LostFocus()
If ActualBonus = TotalBonus Then
MsgBox "Bonus OK"
Else
End If
 
Use the controls after update event.

and, for your code go:

if me.ActualBonus = me.TottalBonus then
msgbox "bonus OK"
end if
 
Private Sub TotalBonus_LostFocus()
If Me.TotalBonus = Me.ActualBonus Then
MsgBox "Bonus OK", vbOKOnly, "Bonus ?"
End If
End Sub
 
Not sure if the actual bonus or the total bonus are added 1st ?
 
Scafidel said:
I can't seem to get this to work. In the code below, ActualBonus is a
calculation and TotalBonus is entered by the user; both are text fields.
I
would like the message to appear after entering the data, but it doesn't
seem
to work. I can substitute the value of either [ActualBonus] or (a
correct)
[TotalBonus] and it works.
Thanks

Private Sub TotalBonus_LostFocus()
If ActualBonus = TotalBonus Then
MsgBox "Bonus OK"
Else
End If
 
Thanks everyone. I found my error. I had an input mask for TotalBonus that
moved the $ sign, so it appeared as $ 2,600.00 instead of $2,600.00.
--
Scafidel
Lafayette, Louisiana


philippe said:
Scafidel said:
I can't seem to get this to work. In the code below, ActualBonus is a
calculation and TotalBonus is entered by the user; both are text fields.
I
would like the message to appear after entering the data, but it doesn't
seem
to work. I can substitute the value of either [ActualBonus] or (a
correct)
[TotalBonus] and it works.
Thanks

Private Sub TotalBonus_LostFocus()
If ActualBonus = TotalBonus Then
MsgBox "Bonus OK"
Else
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top