Dynamic Select Boxes

Results 1 to 2 of 2

Thread: Dynamic Select Boxes

  1. #1
    Matt Harvey Guest

    Default Dynamic Select Boxes

    Hey all-<BR> I&#039ve got a table (prodinfo) in an Access DB that has this structure:<BR> ProdID -&#062; Primary Key<BR> ProdType -&#062; not unique (i.e. Hardware, software, phone, other)<BR> Platform -&#062; not unique (i.e. PC, AS/400, etc.)<BR> Prodname -&#062; not usually unique (name of product)<BR> Responsible Group -&#062;not really relevant to this problem, but <BR>describes what group is responsible for this product.<BR><BR>I am trying to create a series of three dynamic selection boxes. In the <BR>first box, you would select the prodType from the list. This would <BR>dynamically change the other two boxes. The second box would show all <BR>platforms that are of the type selected from the first box (i.e. <BR>selecting Hardware from listbox 1 would show PC, AS/400, etc. in second) <BR> the third box need not change upon this operation. Then you would <BR>chose a platform from the second box, and the third would change to show <BR>the contents of the DB that meet the criteria for the first two boxes. <BR>This info would relate to a unique ProdID for each product. I have <BR>dynamicselect.inc and I have the following code:<BR><BR>&#060;%<BR> SET rsPrimary = Server.CreateObject("ADODB.RecordSet")<BR> SET rsSecondary = Server.CreateObject("ADODB.RecordSet")<BR> SET rsTertiary = Server.CreateObject("ADODB.RecordSet")<BR> strSQL = ""<BR> strSQL = "SELECT ProdType, Platform FROM Prodinfo"<BR> rsPrimary.Open strSQL, objConn<BR><BR> IF NOT (rsPrimary.BOF AND rsPrimary.EOF) THEN<BR> intFirst = rsPrimary("Platform")<BR> ELSE<BR> intFirst = 0<BR> END IF<BR><BR> strSQL = "" <BR> strSQL = "SELECT Prodinfo.ProdID, Prodinfo.ProdType, <BR>Prodinfo.Platform, Prodinfo.Prodname FROM Prodinfo"<BR> <BR>rsSecondary.Open strSQL, objConn<BR><BR> IF NOT (rsSecondary.BOF AND rsSecondary.EOF) THEN<BR> intSecond = rsSecondary("Prodname")<BR> ELSE<BR> intSecond = 0<BR> END IF<BR> <BR> strSQL = ""<BR> strSQL = "SELECT Prodinfo.ProdID, Prodinfo.ProdType, <BR>Prodinfo.Platform, Prodinfo.Prodname FROM Prodinfo"<BR> rsTertiary.Open strSQL, objConn<BR><BR> FillArray "arrList", rsSecondary, "ProdID", "Platform", "Platform"<BR> FillArray "arrCompon", rsTertiary, "ProdID", "ProdName", "ProdName" <BR>%&#062;<BR> &#060;TD&#062;Primary List:<BR><BR> &#060;% SelectBox rsPrimary, "CatList", "ProdType", "ProdType", <BR>"lstProdinfo", "arrList" %&#062; <BR> &#060;/TD&#062;<BR> &#060;TD&#062;Secondary List:<BR><BR> &#060;% rsSecondary.Filter = "Platform = &#039" & intFirst & "&#039"<BR> SelectBox rsSecondary, "lstProdinfo", "Platform", "Platform", <BR>"lstProdInfo", "arrCompon" <BR> rsSecondary.Filter = adFilterNone %&#062;<BR> &#060;/TD&#062;<BR> &#060;TD&#062;Tertiary List:<BR><BR> &#060;% rsTertiary.Filter = "Prodname = &#039" & intSecond & "&#039"<BR> SelectBox rsTertiary, "lstProdInfo", "ProdName", "ProdName", <BR>"", ""<BR> rsTertiary.Filter = adFilterNone %&#062;<BR> &#060;/TD&#062;<BR><BR><BR>It sort of works in the sense that it shows all the platforms in the <BR>first box (but prints the product type for each record in the <BR>table--probably need a DISTINCT somewhere), the second and third boxes <BR>don&#039t get populated correctly at all. Can anyone help me out with this? <BR> Changing the structure of the DB would be no problem, if that is <BR>necessary.

  2. #2
    Join Date
    Dec 1969

    Default CROSSPOST


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts