Results 1 to 8 of 8
  1. #1
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Orphaned button code (A2K SR1)

    I occasionally get code behind a button detaching itself from its parent button for no apparent reason (I suspect I am not alone in this!)
    My DB consists of 30-odd forms so finding these is a right royal PITA!
    Does anyone know of a <img src=/S/free.gif border=0 alt=free width=30 height=15> utility which cycles through your forms and detects any instances of this happening or does anyone have any code to do this which they would be willing to share?

    TIA
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Orphaned button code (A2K SR1)

    This may not be an answer to your problem, but.

    The only time I've seen something like this is when changing the names of the buttons.
    The code still resides with the buttons old name.

    Do you have Tools|Options|General|Name Autocorrect. enabled ?

    Try disable and see if the problems still persists.

  3. #3
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Orphaned button code (A2K SR1)

    I haven't had Name Autocorrect enabled for about 2 years! It causes some major screw-ups in Access.
    I haven't renamed any buttons either. The button's name is the same - the code is still there but the button loses the connection between the event and the code. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    All I want is an easy way to find anywhere where this has happened - i.e. something to run just before I create my mde file to distribute an update.

    Thanks anyway Dave.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Orphaned button code (A2K SR1)

    You wrote:
    ??but the button loses the connection between the event and the code.<<

    Steve,

    I assume you mean that the button's event property no longer contains "[Event Procedure]", even though there is such procedure code? I don't think I've ever had this happen spontaneously. Besides renaming buttons, the only other time I've seen it happen is when I've cut and pasted a button within a form (say to move it to/from a tab page). Could there be any code involved that is clearing out the event property setting?
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Orphaned button code (A2K SR1)

    No code which clears the property settings of that button. It only happened once, but of course I didn't notice it until it was too late!

    I guess I'll put it down to one of Access's 'funny little ways'

    I might try to write some code to check for this if I get bored over Christmas! (Assuming it is possible)

    Looping through the forms and then the buttons - no problem; detecting missing OnClick event code without actually running it - that might be tricky
    Any thoughts/air code gratefully received.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Orphaned button code (A2K SR1)

    As Mark suggests, the only time I've seen this is when I have cut a control and moved it, even just between the detail section and a footer or header.
    Charlotte

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Orphaned button code (A2K SR1)

    You can reference it like this:

    If cboSomething.AfterUpdate <> "[Event Procedure]" then ...

    However, you also would also need code to walk through the form's code module and generate a list of event Procs first and then parse out the control names so you knew which ones *should* have an event procedure. .
    Charlotte

  8. #8
    4 Star Lounger SteveH's Avatar
    Join Date
    Jan 2001
    Location
    Chelsea, Gtr London, United Kingdom
    Posts
    587
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Orphaned button code (A2K SR1)

    I feel a good book/'Help' files coming on.

    Thanks for that starter Charlotte.
    Steve H
    IT Lecturer/Access Developer
    O2K SR3/O2010; Win7Pro

Posting Permissions

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