Thingol
Technical User
- Jan 2, 2002
- 169
Hi all,
I am trying to create a selection tool in my contacts database. I have a form in which I can fill a listbox (lstZoekResultaat) with the results from a custom search that's based on text entered in some textboxes/comboboxes.
This all works as it should!
Now I want to be able to create a second listbox (lstSelectie) to which a user can move items that he has selected in lstZoekResultaat. I tried using the code in the FAQ702-4246.
I adapted all the names of listboxes and buttons in the FAQ code, to fit my form. I have remmed out the closeform statements and all but one of the closeform statements (I only left the Reset buttons instruction). I'm not posting the code, I hope the FAQ code, together with my comments will be sufficient.
I get an error message upon running the code:
Runtime error 9:
Subscript out of range
(This was loosely translated from Dutch, so it may not be literal.)
I get the error both in the routine cmdSelect_Click() as in the routine cmdSelectAll_Click(), and the error shows in this line:
I think it may have to do with the fact that my "From Listbox" has a code generated query as rowsource. I also think this may prevent the Deselect and DeselectAll codes from running correctly, although I haven't tested these yet.
Can anyone help me on starting to solve this? I am not sure where to begin. If more code is needed, please let me know, I didn't want to overinform everyone with all the code in the form.
Thanks a lot in advance for any help! It will be greatly appreciated.
Best regards,
Martijn Senden.
In the Beginning there was nothing, which exploded.
--Terry Pratchett, Lords and Ladies--
I am trying to create a selection tool in my contacts database. I have a form in which I can fill a listbox (lstZoekResultaat) with the results from a custom search that's based on text entered in some textboxes/comboboxes.
This all works as it should!
Now I want to be able to create a second listbox (lstSelectie) to which a user can move items that he has selected in lstZoekResultaat. I tried using the code in the FAQ702-4246.
I adapted all the names of listboxes and buttons in the FAQ code, to fit my form. I have remmed out the closeform statements and all but one of the closeform statements (I only left the Reset buttons instruction). I'm not posting the code, I hope the FAQ code, together with my comments will be sufficient.
I get an error message upon running the code:
Runtime error 9:
Subscript out of range
(This was loosely translated from Dutch, so it may not be literal.)
I get the error both in the routine cmdSelect_Click() as in the routine cmdSelectAll_Click(), and the error shows in this line:
Code:
For i = 0 To nRows * nCols - 1
[highlight] astrTo(iTo + i) = astrFrom(i)[/highlight]
Next i
I think it may have to do with the fact that my "From Listbox" has a code generated query as rowsource. I also think this may prevent the Deselect and DeselectAll codes from running correctly, although I haven't tested these yet.
Can anyone help me on starting to solve this? I am not sure where to begin. If more code is needed, please let me know, I didn't want to overinform everyone with all the code in the form.
Thanks a lot in advance for any help! It will be greatly appreciated.
Best regards,
Martijn Senden.
In the Beginning there was nothing, which exploded.
--Terry Pratchett, Lords and Ladies--