Results 1 to 4 of 4
  1. #1
    tuna is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    21

    Cancel form navigation event

    Hi, is there any way to cancel navigation to a different record?



    I want to make sure that a subform has exactly one record before allowing the user to move away from the current record or close the form, and cancel the close/navigation if necessary. The close event was easy enough, but I can't find any events for changing records except for OnCurrent, but that is too late.

    Microsoft documents a promising event called "RecordExit", but I can't seem to find it in the form property sheet in Access 2007.

    Thanks

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    If the form has been modified then we use the BeforeUpdate event of the FORM for such a function.

  3. #3
    tuna is offline Novice
    Windows Vista Access 2007
    Join Date
    May 2010
    Posts
    21
    Thanks, but what if it hasn't been altered? Also, wouldn't this end you up in a loop whereby if you cancel the BeforeUpdate to let the user amend the subform, and in doing so would cause the subform to be entered, thereby causing the main form to fire the BeforeUpdate event again as the parent form loses focus.

    Thanks

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Without a form LeavingRecord event you simply need to get a little creative. Set a Global/Public variable/flag when in the SubForm and test for it in the BeforeUpdate event of the MainForm.

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

Similar Threads

  1. Cancel Selection Event for ListBox
    By is49460 in forum Forms
    Replies: 2
    Last Post: 08-04-2010, 05:53 PM
  2. Replies: 3
    Last Post: 06-04-2010, 12:47 PM
  3. Replies: 0
    Last Post: 12-12-2009, 04:45 PM
  4. Replies: 3
    Last Post: 10-18-2009, 09:17 AM
  5. Replies: 4
    Last Post: 04-01-2009, 11:48 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
  •  
Other Forums: Microsoft Office Forums