+ Reply to Thread
Results 1 to 1 of 1

Thread: Dynamic Combo Maker

  1. #1
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    Dynamic Combo Maker

    Code:
    sub comboMaker(varSQL, varID, varField, varSelected)	
    ' This sub creates a generic combo box with values from a table
    	set rsDD = GetRS(varSQL)  'See recordset and connection function in this same forum
    	do while not rsDD.eof
    		response.Write("<option value=""" & rsDD(varID) & """")
    		if varSelected <> "" then
    			if cstr(rsDD(varID)) = cstr(varSelected) then
    				response.Write(" selected ")
    			end if
    		end if 
    		response.Write(">" & rsDD(varField) & "</option>" & vbCrLf)
    		rsDD.MoveNext
    	loop
    end sub
    
    then to use
    Code:
    strSQL = "SELECT intID, strField FROM tbl_TableName ORDER BY strField"
    response.Write("<select name=""testDropDown"">" & vbCrLf
    response.Write(vbTab & "<option value="""">Select ....</option>" & vbCrLf
    Call comboMaker(strSQL, intID, strField, request("testDropDown"))
    respone.Write("</select>")
    
    Last edited by mehere; September 22nd, 2008 at 04:36 PM.
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

+ Reply to Thread

Similar Threads

  1. Adding ALL Button to Combo Box
    By Northernlion in forum Microsoft Access
    Replies: 3
    Last Post: July 8th, 2008, 02:03 PM
  2. Combo Box - Add Entry Not In List
    By AOG123 in forum Access Database Samples
    Replies: 0
    Last Post: June 6th, 2008, 10:35 AM
  3. Quick Links - Combo Open Forms
    By AOG123 in forum Access Database Samples
    Replies: 0
    Last Post: June 4th, 2008, 09:46 AM

Bookmarks

Posting Permissions

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

SEO by vBSEO