General discussion

  • Creator
    Topic
  • #2187078

    ASP/Access Update Table by DropDown Menu

    Locked

    by jlindemann ·

    I’m a bit of a newbie when it comes to using a database with a webpage. It is important that I use MSAccess for this.

    I’m trying to create a business directory that will show results depending on what is chosen in the category list.
    Inside this database I have a table which holds these fields: Category – Business – Address – Phone – Fax.
    On my webpage I have a drop-down menu that will hold a list of each one of the Category items in it. When I select an item from the Category list I want my table to give me all the businesses in that selected category. (just as a side note, my table is created as a “Repeated – Server Behaviour” item with the items of database.business – database.address – database.phone – database.fax) Problem is, how do I do this? Everywhere I look I keep finding ways to “auto-populate” my drop-down list. But that’s not what i want to do. What I want is to populate my table according what the drop-down list item that is chosen. Can you help point me out how to do it?

All Comments

  • Author
    Replies
    • #3191328

      Reply To: ASP/Access Update Table by DropDown Menu

      by unwanted_email ·

      In reply to ASP/Access Update Table by DropDown Menu

      Hi

      I’ve created a working example of how I would go about it. Email me at unwanted_email@hotmail.com if you would like a zipped copy of it. Below is the code I used. Regards Darren.

      <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
      <% 'Connect to db Set db = Server.CreateObject("ADODB.Connection") strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data source="& Server.MapPath("database.mdb") db.Open strconn 'Set Recordsets dim category if request.QueryString("category")<>“” then
      category = request.QueryString(“category”)
      Set rsfilter = db.Execute(“SELECT * FROM tblContacts WHERE Category='” & category & “‘”)
      else
      category = “All Categories”
      Set rsfilter = db.Execute(“SELECT * FROM tblContacts”)
      end if
      Set rsdistinct = db.Execute(“SELECT DISTINCT Category FROM tblContacts ORDER BY Category ASC”)
      %>



      Example


       

      <% do until rsfilter.eof %>

      <% rsfilter.movenext loop %>

      Category: <%Response.Write(category)%>
      Business Address Phone Fax
      <%response.Write(rsfilter("Business"))%> <%response.Write(rsfilter("Address"))%> <%response.Write(rsfilter("Phone"))%> <%response.Write(rsfilter("Fax"))%>


      <% db.Close Set db = Nothing %>

    • #3155122

      Reply To: ASP/Access Update Table by DropDown Menu

      by jlindemann ·

      In reply to ASP/Access Update Table by DropDown Menu

      This question was closed by the author

Viewing 1 reply thread