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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare RecordSet 1

Status
Not open for further replies.

Gatorajc

MIS
Mar 1, 2002
423
US
Can someone tell me why this is not working. I am trying to have the previous selected department be the selected choice in the drop down but it does not seem to like it. For some reason I have gone blank. I blame it on the short week this week (in the US anyway sorry everybody else).

<% WHILE NOT RS.EOF %>
<option value=&quot;<%=RS(&quot;DepartmentID&quot;)%>&quot;

this part does not seem to work
<%if RS(&quot;DepartmentID&quot;) = department then %>selected

<%end if%>>
<%=RS(&quot;DepartmentName&quot;)%></option>
<%
RS.MoveNext
Wend
%> AJ
I would lose my head if it wasn't attached. [roll1]
 
Did you check to make sure that department has a value in it? Plus you might want to ucase() both of them to do the compare so you don't have case issues.

Hope this helps!
 
Also, you might want to use TRIM on both of them to make sure there are no trailing spaces on either value.
 
Hi AJ,

How about forcing both values to Int before comparing them??

ie)

Code:
<%if CInt(RS(&quot;DepartmentID&quot;)) = CInt(department) then %>selected

sometimes I get similar problems with mismatched data types

hope this helps
Tony
 
Thanks everybody. Star for you Tony that worked. I knew I had done it that way before. AJ
I would lose my head if it wasn't attached. [roll1]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top