Consulting

Results 1 to 2 of 2

Thread: Prevent sub routines from running

  1. #1
    VBAX Tutor
    Joined
    Dec 2006
    Posts
    271
    Location

    Prevent sub routines from running

    Is there any code to prevent sub routines running?

    I have a user form that displays records and it that uses various controls with code activating on change events.
    I also have a button which resets the form to allow a new entry to be added, but I want to disable the on chnage routines.
    Is this possible?

    ie
    On cmdButton click ignore Private Sub cboType_Change()

    TIA

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I do it with a simple flag, like so

    [vba]

    If Not fReEntry Then
    fReEntry = True
    'do the event stuff
    fReEntry = False
    Endif
    [/vba]

    and then I can set that flag in mu=y code elsewhere.

    It works but is cumbersome, as you have to add it to all such events.

Posting Permissions

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