OK here is the sample. I use the form that you had posted in the sample. I take the values of month and year selected by the client and used them to query a database I created. The database contains a table called PathandTable. Within PathandTable there are 4 columns Path (a text field that contains the actual path to another database), Table (a text field that contains the name of the table that I want to query),Month (an int field) and Year (an int field).
I pass the month and year the client selects to the PathandTable table. From the recordset that is returned I grab the value of Path and Table and assign them to variables. I use those variables to execute a second query which returns in the case of this sample a list of firstnames and writes them out to the page. All you need to do is change the data source for the first query and point it to the database that you are using to track your order databases with and then change the table name in the first Select statement from PathandTable to the name of the table in your database.
Hope this helps
EE
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META name=VI60_defaultClientScript content=VBScript>
</HEAD>
<BODY><%'This if statement keeps the queries from running before the client has selected a month and year.
<%If Request("Month")= "" Then%>
<form method="POST" name="myform">
<P ALIGN="Center"> Order: <input type="text" size="12" name="Order" value = ""> </p>
<P ALIGN="Center"> <br><center>
<input type="submit" value="Billing" action="asp page2.asp">
<select name="MONTH" size="1">
<option selected value="0">January</option>
<option value="1">Febuary</option>
<option value="2">March</option>
<option value="3">April</option>
<option value="4">May</option>
<option value="5">June</option>
<option value="6">July</option>
<option value="7">August</option>
<option value="8">September</option>
<option value="9">October</option>
<option value="10">November</option>
<option value="11">December</option>
</select>
<select name="YEAR" size="1">
<option value="1999">1999</option>
<option value="2000">2000</option>
<option selected value="2001">2001</option>
</select>
</center></p>
</form>
<%Else
Dim objConn,myMonth,myYear,WhereClause
myMonth = Request("Month")
myYear = Request("Year")
myMonth = cint(myMonth)
myYear = cint(myYear)
WhereClause = "Where"&" "& "PathandTable.Month=" &" "& mymonth & " " & "and PathandTable.Year=" & " "& myYear
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=C:\Documents and Settings\Administrator\Desktop\Mine\amsample.mdb;" 'Replace the data source I have here with the path to your database where the table and path names are stored.
objConn.Open
Dim RS
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "SELECT * FROM PathandTable " & WhereClause,objConn,adOpenStatic,adLockOptimistic
%>
<%
Dim rsPath,rsTable
'These are the variables that you will use in
'the query to retrieve the list of orders for the month and yr the client has specified
rsPath = Trim(rs.Fields("Path").value)
rsTable = Trim(rs.Fields("Table").value)
rs.Close
rsPath = cstr(rsPath)
rsTable = cstr(rsTable)
set rs = nothing
%>
<%Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
'the rsPath variable is used here to set your path to the database
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" & rsPath & ";"
Conn.Open
Dim RSorder
Set RSorder = Server.CreateObject("ADODB.Recordset")
'the rsTable variable is used here to specify the Table you want to query
RSorder.Open "SELECT * FROM " & rsTable, Conn,adOpenStatic,adLockOptimistic%>
<table>
<%Do until RSorder.EOF%>
<tr>
<td><%=RSorder.Fields("AR_FirstName").value%></td>
<%RSorder.MoveNext
Loop
RSorder.Close
set rsorder= nothing
End if%>
</BODY>
</HTML>
[This message has been edited by Elecia (edited 03-16-2001).]