Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Types of Varables

Status
Not open for further replies.

nsanto17

IS-IT--Management
Mar 14, 2005
616
US
I have a page that pulls data from a database. In the Database are the following values

P - PTC (Prior To Closing)
C - AC (At Closing)
S - Suspense (Prior To Closing)

I have created the a varable which works fine to display the catagory of each letter.

Code:
<%
If  (Conditions.Fields.Item("RemoveCond").Value) = "C" Then 
	varCondType = "AC"
	else
	varCondType = "PTC"
End If 
%>

I want to use the varCondType in my Order By Clause in my recordset. I am not sure how to do that.

Can anyone help???

Thanks in advance.

Nick
 
what database are you using? If you are using good ole access then you could apply a .filter and requery the existing recordset.

&quot;There are 3 kinds of people; those that can count and those that can't&quot;
 
ok, you could try doing this, we are going away from DW here mind you!
<%
Sub sFilterRS()
Dim db As Database, rs1 As Recordset
Dim rs2 As Recordset
Set db = CurrentDb
Set rs1 = db.OpenRecordset("Select * from tblRuns")
If (rs1.Fields.Item("RemoveCond").Value) = "C" Then
varCondType = "AC"
else
varCondType = "PTC"
End If

Set rs2 = rs1.OpenRecordset
rs2.Filter = "ORDER BY "&varCondType&" ASC"
Response.write rs2("name of field")
Set rs2 = Nothing
Set rs1 = Nothing
Set db = Nothing
End Sub
%>

Then place a call on the Sub like

<%CAll(sFilterRS)%>

This should write out the first line of the filtered rs2, you can loop it using a while loop if you want to write out the whole lot

Have fun!


&quot;There are 3 kinds of people; those that can count and those that can't&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top