Results 1 to 14 of 14

Thread: Events Not Firing

Threaded View

  1. #1
    Join Date
    Dec 2009
    Posts
    79

    Events Not Firing

    I have an Access 2003 database. On one of the forms, I have a textbox, called txtTotal, whose control source is set to add up all of the rest of the textboxes on the form (there are several).

    I have to ensure txtTotal never exceeds 100 (this is actually formatted as Percent, so I'm checking to see that 100% is not gone over)

    I figured it would be pretty easy by doing
    Code:
    Private Sub txtTotal_Change()
    If Val(txtTotal.Text) > 100 Then
       MsgBox "The total for the this metric can not exceed 100%.  
              Please make the necessary adjustments."
             , vbOKOnly + vbExclamation, "Total Exceeds 100"
       txtTotal.ForeColor = vbRed
       txtTotal.FontBold = True
    Else
       txtTotal.ForeColor = vbBlack
       txtTotal.FontBold = False
    End If
    End Sub
    But, much to my surpise the code never ran because the event did not fire when the total in the textbox changed. So, I moved the above code to the AfterUpdate event....that never fired either nor did the BeforeUpdate event.

    In each of these events I had a break set on the Private Sub line. But nothing happened on any occasion.

    I am pretty experienced in VB6 and VB.NET...not so much in VBA so I don't know what I'm missing here. Why aren't these events firing when I make a change to the totals textbox?
    Last edited by Moe1950; 09-29-2011 at 05:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •