Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Suggestion on killing an event (MSACCESS 2003)

    Listbox Event

    Select a record, recorset of form set. Go into edit mode of fields on form no problem.

    However to stop a user selecting another record from the list during edit, I have an event on the onclick thats has rembered the listitem that has been selected. If its the same record then no action, however if a different record, then a dialogue appears saying its not allowed, and the stored listindex value resets the list. That all works okay, I did disable the list during the edit operation, but it caused a listbox repaint.

    However I have found the listbox gets another click event if the user clicks on a button with no active code in it. Why does it get this second shot? Any ideas how to kill this extra event, as my recordset requeries for nothing? Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Suggestion on killing an event (MSACCESS 2003)

    Why not set the Enabled property of the list box to False during the edit phase (or set the Locked property to True)?

  3. #3
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suggestion on killing an event (MSACCESS 2003)

    Hi Hans. As I said, I originally set the list to disabled during edit, however the listbox shows two unwanted refreshes, one of them I now no it gets when you offclick the list onto something else. I am getting really fedup with this bug, even wondering whether to dump the listbox for a continuos form. Regards

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Suggestion on killing an event (MSACCESS 2003)

    I sometimes use a module-level boolean variable named something like blnIgnoreEvents. If I want a control to ignore an event such as the On Click event, I set the variable to True. The On Click event procedure for the control looks like this:

    Private Sub MyControl_Click()
    If blnIgnoreEvents = True Then
    Exit Sub
    End If
    ' Rest of the code goes here
    ...
    End Sub

  5. #5
    4 Star Lounger
    Join Date
    Feb 2008
    Location
    United Kingdom
    Posts
    490
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Suggestion on killing an event (MSACCESS 2003)

    Thanks Hans. When I make the listbox disabled with a command button, it does not get an onlick event on the listbox, so there is nothing to slug. I think I will try and get rid of the listbox. I presume I can use the subform principle to include an unbound form with a continuos form on. Will have a look, but thanks again for your appreciated help.

Posting Permissions

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