I am receiving the message "Object Required" trying on this line "Select Case MIFLocation.value". I am trying to populate a drop-down box from an Access database. Can someone show me where I went wrong. I have written code that is basically the same and it is working fine. Maybe my eyes are going bad.
<td align="left">Location:<br>
<select size="1" width="40" name="LocationName" tabindex="1">
<script language="VBScript">
Sub PopulateLocation(MIFLocation)
Set dbLocation = CreateObject("ADODB.Connection")
Dim strConnectionString
Const strDataSource = "\\ssweb\inventory\inventory.mdb"
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&strDataSource&";"
dbLocation.Open strConnectionString
For Each objOption In LocationName.Options
objOption.RemoveNode
Next
Set rstOptions = CreateObject("ADODB.Recordset")
Select Case MIFLocation.value
Case "1" 'SD Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop'"
Case "2" 'HS Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop' "
Case "3" 'FS Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop' "
Case "4" 'Plant Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop' "
End Select 'PopulateDepartments
rstOptions.Open strSQL, dbLocation
Set objLocationName = rstOptions("LocationLongName")
Set objLocationID = rstOptions("idLocation")
Do While Not rstOptions.EOF
Set objOption = Document.createElement("OPTION")
objOption.Text = objLocationName & " (" & objLocationName & ")"
objOption.Value = objLocationID
LocationName.Add(objOption)
rstOptions.movenext
Loop
dbInventory.close
End Sub
</script>
</select>
</tr>
<td align="left">Location:<br>
<select size="1" width="40" name="LocationName" tabindex="1">
<script language="VBScript">
Sub PopulateLocation(MIFLocation)
Set dbLocation = CreateObject("ADODB.Connection")
Dim strConnectionString
Const strDataSource = "\\ssweb\inventory\inventory.mdb"
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&strDataSource&";"
dbLocation.Open strConnectionString
For Each objOption In LocationName.Options
objOption.RemoveNode
Next
Set rstOptions = CreateObject("ADODB.Recordset")
Select Case MIFLocation.value
Case "1" 'SD Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop'"
Case "2" 'HS Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop' "
Case "3" 'FS Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop' "
Case "4" 'Plant Group
strSQL = "SELECT * FROM tblLocationLookup WHERE LocationShortName = 'pop' "
End Select 'PopulateDepartments
rstOptions.Open strSQL, dbLocation
Set objLocationName = rstOptions("LocationLongName")
Set objLocationID = rstOptions("idLocation")
Do While Not rstOptions.EOF
Set objOption = Document.createElement("OPTION")
objOption.Text = objLocationName & " (" & objLocationName & ")"
objOption.Value = objLocationID
LocationName.Add(objOption)
rstOptions.movenext
Loop
dbInventory.close
End Sub
</script>
</select>
</tr>