Results 1 to 5 of 5
  1. #1
    caddcop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Upper Marlboro, Maryland, USA
    Posts
    57

    Events are "Non-Events"

    I have the following three events in my project. Earlier today, I was seeing results from some of these.
    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
        Dim Result As VbMsgBoxResult
        Debug.Print Me.Name & " firing BeforeUpdate and Me.Dirty = " & Me.Dirty
        Result = MsgBox("OK saves, Cancel aborts.", vbOKCancel + vbCritical, "Continue?")
        If Result = vbCancel Then Cancel = True
    End Sub
    Code:
    Private Sub Form_Dirty(Cancel As Integer)
        Debug.Print Me.Name & " firing Form_Dirty and Me.Dirty = " & Me.Dirty
    End Sub
    Code:
    Private Sub Tab_Description_Click()
        Debug.Print Me.Name & " firing Tab_Description_Click and Me.Dirty = " & Me.Dirty
    End Sub
    The middle one proved to me that the Dirty Event worked, but when executed, had not set the dirty property.
    The top one confirmed that I could get in front of an update, even when it was triggered because a tab with a subform was activated and demonstrates how to cancel an update in code.
    The last one was added to see where in this sequence would the tab click occur.


    Since adding the tab click event, my events have become non-events - they are not firing.
    WTF?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The "Tab Click Event" has always been a disappointment so developers use the Tab Change Event.

  3. #3
    caddcop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Upper Marlboro, Maryland, USA
    Posts
    57
    Well, I was able to add the Change event to the main tab ctrl and it is firing off like a fiend. I deleted the Tab Click event, but left the Form_Dirty event and the Before_Update event - neither of which is firing.
    I found a kb (http://support.microsoft.com/kb/198639) article that describes using a select case inside of the tab control change event to get a tab click event that works.
    It also explains that the tab itself is not part of the tab page, so to get a tab click event, you need to click on the tab to see the page and then click on the page.
    None of this explains why my Form_Dirty event is failing to fire!

  4. #4
    caddcop is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Upper Marlboro, Maryland, USA
    Posts
    57
    OK, this is the deal. Somehow, my form's properties were missing the [Event Procedure] on the Event tab. Since these were working earlier, I cannot be sure what caused them to get cleared.
    ARRRRRRGH!

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for posting back with your success!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. ComboBox "Select" and "DLookUp"
    By witooldas in forum Forms
    Replies: 0
    Last Post: 03-23-2011, 03:31 AM
  2. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  3. Replies: 3
    Last Post: 04-10-2010, 10:22 AM
  4. aSTR = Dir("C:\*.*") >> "Type Mismatch"
    By JGrant in forum Programming
    Replies: 1
    Last Post: 03-28-2009, 05:17 AM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums