[AccessD] Form hangs when setting listbox selected index

Susan Harkins ssharkins at setel.com
Tue Jun 12 15:41:39 CDT 2007


It's a conflict in events, but I don't have an explanation -- can pinpoint
it for you exactly. When I moved the selection to the control's Got Focus
event or the Form's Load event, it worked fine. You're right though -- I had
no problem re-creating the problem. 

Load should work just as well as open -- for the most part. 

Susan H.  

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christopher Jeris wrote:
> I would have used .RowSource, but in the actual location where this 
> construct is used, I need to supply parameters to the query that 
> populates the listbox, and those parameters are determined by other 
> settings.  I didn't see a way to do that with the .RowSource property, 
> which seems to take only the name of a table or query, or else a 
> statically determined list of values.

Actually, I need not set the data source of the listbox control with VB code
at all, which suggests that I am misunderstanding something fundamental.
Here is the simplest possible case I can find:

1. Create a blank database.
2. Create a single table Table1, with a single TEXT(50) field field1.  I
chose not to make any primary key on this test table, in case it matters.
3. Insert three rows into the table, with text "A", "B", "C".
4. Create a single form Form1 in Design view.
5. Insert a listbox control List0 onto the form; cancel out of the wizard.
6. Set the control's RowSource property to be "Table1".
7. Add the following event handler:
    Private Sub Form_Open(Cancel As Integer)
        Me!List0.Selected(0) = True
    End Sub

Now, when the form is saved, closed, and opened in Form view, and I click on
the listbox List0, the dotted focus box does not appear and the selection
does not change.  In fact, the form becomes completely unresponsive, as can
be verified by adding more controls to it.

Steve Schapel wrote:
> Admittedly just shooting in the dark here...  Does your listbox have 
> the Column Heads property set to Yes?  Could you experiment with 
> changing that?  Does the same problem occur if you try with another 
> item in the listbox for example
>   Me!List0.Selected(1) = True

Column Heads is set to No, but changing it to Yes does not alter the
problem.  The problem still occurs if the index 0 is replaced by 1 or 2.

peace,
Chris Jeris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGbwGq5ICCNV0oGWARAnVtAJ49GA5B2Bv10AunXH0Bg108KZ9FIQCfTBvL
t+X9PkvnNw4rztyOmmRLgP0=
=ef0Y
-----END PGP SIGNATURE-----
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.472 / Virus Database: 269.8.11/838 - Release Date: 6/7/2007
2:21 PM
 




More information about the AccessD mailing list