<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Populating list boxes during form initialisation in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285176#M44766</link>
    <description>Hi,

I'm reading data from a data base and using the data to populate two list
boxes using the form Initialisation event.

My ambition is to populate one list box first, set it's list index to 0 and
then read the value from there as a selection parameter for populating the
second list box.

However, as I step through the code I find that the first list box has no
value during the form initialisation.

It makes no difference if I move the code to the Form Activate event during
the initial opening of the form.

Is this the normal way forms are activated - ie that list boxes have no
readable data till the form actually appears to the user?

I have used a work around by sending the first value in the first box to a
temporary variable, but that seems inelegant.

-- 


Laurie Comerford
CADApps
www.cadapps.com.au</description>
    <pubDate>Sat, 02 Apr 2005 06:44:20 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2005-04-02T06:44:20Z</dc:date>
    <item>
      <title>Populating list boxes during form initialisation</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285176#M44766</link>
      <description>Hi,

I'm reading data from a data base and using the data to populate two list
boxes using the form Initialisation event.

My ambition is to populate one list box first, set it's list index to 0 and
then read the value from there as a selection parameter for populating the
second list box.

However, as I step through the code I find that the first list box has no
value during the form initialisation.

It makes no difference if I move the code to the Form Activate event during
the initial opening of the form.

Is this the normal way forms are activated - ie that list boxes have no
readable data till the form actually appears to the user?

I have used a work around by sending the first value in the first box to a
temporary variable, but that seems inelegant.

-- 


Laurie Comerford
CADApps
www.cadapps.com.au</description>
      <pubDate>Sat, 02 Apr 2005 06:44:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285176#M44766</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-02T06:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: Populating list boxes during form initialisation</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285177#M44767</link>
      <description>It's hard to say what the problem might be without a look at the code.  Does this do something like what you want?&lt;BR /&gt;
&lt;BR /&gt;
Private Sub ListBox1_Click()&lt;BR /&gt;
   Dim s As String&lt;BR /&gt;
   &lt;BR /&gt;
   s = ListBox1.List(ListBox1.ListIndex)&lt;BR /&gt;
   &lt;BR /&gt;
   With ListBox2&lt;BR /&gt;
      .Clear&lt;BR /&gt;
      .AddItem s &amp;amp; "_1"&lt;BR /&gt;
      .AddItem s &amp;amp; "_2"&lt;BR /&gt;
      .AddItem s &amp;amp; "_3"&lt;BR /&gt;
      .AddItem s &amp;amp; "_4"&lt;BR /&gt;
   End With&lt;BR /&gt;
&lt;BR /&gt;
End Sub&lt;BR /&gt;
&lt;BR /&gt;
Private Sub UserForm_Initialize()&lt;BR /&gt;
   With ListBox1&lt;BR /&gt;
      .AddItem "1"&lt;BR /&gt;
      .AddItem "2"&lt;BR /&gt;
      .AddItem "3"&lt;BR /&gt;
      .ListIndex = 0&lt;BR /&gt;
   End With&lt;BR /&gt;
&lt;BR /&gt;
End Sub</description>
      <pubDate>Sat, 02 Apr 2005 11:30:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285177#M44767</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-02T11:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Populating list boxes during form initialisation</title>
      <link>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285178#M44768</link>
      <description>If you are loading the first listbox from a recordset in its row order, then
you should have the value for the second listbox's (recordset's) criteria in
the first row of the first recordset.  I'm guessing, maybe misunderstanding.
-- 
John Goodfellow
irtfnm
use john at goodfellowassoc dot com


"Laurie Comerford" &lt;LAURIE&gt; wrote in message
news:424e3e6a_2@newsprd01...
&amp;gt; Hi,
&amp;gt;
&amp;gt; I'm reading data from a data base and using the data to populate two list
&amp;gt; boxes using the form Initialisation event.
&amp;gt;
&amp;gt; My ambition is to populate one list box first, set it's list index to 0
and
&amp;gt; then read the value from there as a selection parameter for populating the
&amp;gt; second list box.
&amp;gt;
&amp;gt; However, as I step through the code I find that the first list box has no
&amp;gt; value during the form initialisation.
&amp;gt;
&amp;gt; It makes no difference if I move the code to the Form Activate event
during
&amp;gt; the initial opening of the form.
&amp;gt;
&amp;gt; Is this the normal way forms are activated - ie that list boxes have no
&amp;gt; readable data till the form actually appears to the user?
&amp;gt;
&amp;gt; I have used a work around by sending the first value in the first box to a
&amp;gt; temporary variable, but that seems inelegant.
&amp;gt;
&amp;gt; -- 
&amp;gt;
&amp;gt;
&amp;gt; Laurie Comerford
&amp;gt; CADApps
&amp;gt; www.cadapps.com.au
&amp;gt;
&amp;gt;&lt;/LAURIE&gt;</description>
      <pubDate>Sat, 02 Apr 2005 19:20:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/populating-list-boxes-during-form-initialisation/m-p/1285178#M44768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2005-04-02T19:20:00Z</dc:date>
    </item>
  </channel>
</rss>

