Consulting

Results 1 to 6 of 6

Thread: Grid Control Rows Not Displaying Selected State Correctly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Grid Control Rows Not Displaying Selected State Correctly

    this is very weird (and urgent).

    when i select rows in a grid control on a form, using access vba, some rows behave exactly the opposite of how they're supposed to behave-- they APPEAR unselected when i select them, and selected when i unselect them. However, when i check their Selected property with VBA they return the expected value.

    video:
    youtu.be/Ae0adXdmT48

    i repeatedly requery the listbox while the form it's on is hidden (MyForm.Visible=False). It seems that the more times i requery, the worse the problem gets.

       
     ' requery
        oListBox.Requery
    Then i select ALL items in the list box by looping through them.

    Sub Select_AllListItems(oListBox As ListBox)
    ' select all items in list
        DoCmd.Echo False
        oListBox.Visible = False
    
        Dim lngRow As Long
        For lngRow = 0 To oListBox.ListCount - 1
            oListBox.Selected(lngRow) = True
        Next
    
        ' jump to top
        oListBox.Selected(0) = True
    
        DoCmd.Echo True
        oListBox.Visible = True
    End Sub
    This problem seems unrelated to the number of times i run the above procedure. It seems only related to multiple requeries. At first, it does not happen. Then with repeated requeries (while the form is hidden), the problem gets progressively worse.

    maybe i'm accessing the form in the wrong way, creating multiple instances or something. But i'm not using the "Form_" syntax anyplace.

    also, this listbox query contains a vba function which is in the code-behind of another form.

    help!

    note, i may post this question on other MS Access forums, so plz only answer in one place. thx!
    Last edited by johnywhy; 03-02-2014 at 02:36 PM.

Tags for this Thread

Posting Permissions

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