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.
Then i select ALL items in the list box by looping through them.' requery oListBox.Requery
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.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
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!



Reply With Quote

