Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dropdown/Combobox population

Status
Not open for further replies.

tEkHEd

IS-IT--Management
Jan 29, 2003
261
GB
Hi there..

I am trying to build an HTA app, with a drop down that is populated from Field0 of an XLS file.

Can someone explain how I can get the field in my recordset to populate the combo please?

Here is my code....

Code:
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>

<html>

          <head>

                   <title>GEOS v3 Build Generator</title>

                   <meta content=&quot;VBScript&quot; name=&quot;vs_defaultClientScript&quot;>

                   <meta content=&quot;Microsoft Visual Studio .NET 7.1&quot; name=&quot;GENERATOR&quot;>

                   <meta content=&quot;[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5&quot;[/URL] name=&quot;vs_targetSchema&quot;>

                   <script language=&quot;vbscript&quot; id=&quot;clientEventHandlersVBS&quot;>

<!--

Sub window_onload

          Dim Src, File

          Const adVarChar = 200

          Const MaxCharacters = 255

          'Set up the initial environment

          call InitialGUIState

 

          Set oFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

          set rsDataList = CreateObject(&quot;ADODB.Recordset&quot;)

 

          File = &quot;C:\Temp\FMLOC.XLS&quot;

 

          Set rsConn = CreateObject(&quot;ADODB.Connection&quot;)

 

          rsConn.ConnectionString = &quot;DBQ=&quot; & File & &quot;; DRIVER=Microsoft Excel Driver (*.XLS);UID=admin;&quot;

          rsConn.Open

                                                                            

          rsDataList.Open &quot;Select * FROM Data&quot;, rsConn, adOpenStatic

 

          lblENH.innerText = &quot;Use the check box to install additional Language Packs.&quot;

           

          rsdatalist.MoveFirst

 

          'I think I need a syntax similar to this:

 

 

          strHTML = &quot;<SELECT id=&quot;&quot;cboBType&quot;&quot; style=&quot;&quot;Z-INDEX: 101; LEFT: 10px; WIDTH: 130px; POSITION: absolute; TOP: 125px&quot;&quot;&quot; & _

                                      &quot;name=&quot;&quot;cboBType&quot;&quot;><Option Value=&quot;&quot;Select Location&quot;&quot; Selected>Select Location</Option>&quot;

                                      '<option value=&quot;F0D1&quot;>F0D1<option value=&quot;F0D2&quot;>F0D2<option selected>Build Type</OPTION>

 

          do until rsdatalist.eof

                   strHTML = strHTML & &quot;<option value= &quot; & chr(34)&_

                                                rsdatalist.fields.item(&quot;Field0&quot;) & chr(34) &_

                                                &quot;>&quot; & rsdatalist.fields.item(&quot;Field0&quot;) & &quot;</Option>&quot;

                   rsdatalist.MoveNext

          loop

   

          

 

 

          cboBtype.insertAdjacentHTML &quot;beforeEnd&quot;, strhtml 'This gives me an unspecified error :(

          

 

 

End Sub

 

'Subs to ensure the GUI is in correct state

Sub InitialGUIState

   cboBType.disabled = False

   cmdOK.disabled = True

   cboBType.selectedIndex = 0

   cboCity.disabled = True

   'msgbox &quot;loading&quot;

End Sub

 

Sub cboBType_onchange

msgbox(&quot;Build Type Changed!&quot;)

cboCity.disabled = false

End Sub

 

-->

                   </script>

          </head>

<body text=&quot;#ffffff&quot; vLink=&quot;#660033&quot; aLink=&quot;#ffff66&quot; link=&quot;#ffff66&quot; bgColor=&quot;#0033cc&quot;>

                   <P align=&quot;center&quot;><STRONG><FONT size=&quot;6&quot;>GEOS v3 Build Generator</FONT></STRONG></P>

                   <P align=&quot;left&quot;><STRONG>Select your build options from the choices below:</STRONG>

                   </SELECT><SELECT id=&quot;cboBType&quot; style=&quot;Z-INDEX: 102; LEFT: 10px; WIDTH: 130px; POSITION: absolute; TOP: 125px&quot;

                                      name=&quot;cboBType&quot;>

                                      <option value=&quot;&quot; selected>Build</OPTION>

                             </SELECT><SELECT id=&quot;cboCity&quot; style=&quot;Z-INDEX: 102; LEFT: 150px; WIDTH: 130px; POSITION: absolute; TOP: 125px&quot;

                                      name=&quot;cboCity&quot;>

                                      <option value=&quot;&quot; selected>City</OPTION>

                             </SELECT></P>

                   <P><INPUT id=&quot;cmdReset&quot; style=&quot;Z-INDEX: 103; RIGHT: 85px; WIDTH: 63px; BOTTOM: 20px; POSITION: absolute; HEIGHT: 24px&quot;

                                      type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;cmdReset&quot;> <INPUT id=&quot;cmdOK&quot; style=&quot;Z-INDEX: 104; RIGHT: 10px; WIDTH: 63px; BOTTOM: 20px; POSITION: absolute; HEIGHT: 24px&quot;

                                      type=&quot;submit&quot; value=&quot;OK&quot; name=&quot;cmdOk&quot;><INPUT id=&quot;chkENH&quot; style=&quot;Z-INDEX: 100; LEFT: 10px; POSITION: absolute; TOP: 175px&quot; type=&quot;checkbox&quot;

                                      name=&quot;chkENH&quot;></P>

                   <DIV id=&quot;lblENH&quot; style=&quot;DISPLAY: inline; LEFT: 40px; WIDTH: 240px; POSITION: absolute; TOP: 175px; HEIGHT: 19px&quot;

                             ms_positioning=&quot;FlowLayout&quot;>Label</DIV>

                   <!--<span id=&quot;cboBType&quot;></span>

                   <div id=TaskSelectDiv style=&quot;position:absolute;left:10px;top:10px;&quot;>

                             <span id=&quot;Locations&quot;>&nbsp;</span>-->

                   </div>

          </body>

</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top