Discussion Locked

ASP/Access Update Table by DropDown Menu

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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?

3 replies

by unwanted_email

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

<%
db.Close
Set db = Nothing
%>

by jlindemann

This didn't help me, and it's been decided that we move towards PHP\mySQL where it can be done easier

This discussion is closed to new replies.