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

I have a database field of all the

Status
Not open for further replies.

Andeelym

Programmer
Jul 29, 2002
4
SG
I have a database field of all the dates.

12/12/01
12/20/01
07/01/02
07/15/02
08/22/02
08/30/02
09/01/02

I would like to make a dropdown box with only the month and year displayed.

December 2001
July 2002
August 2002
September 2002

I can change the values in to the required Monthnames and year but its the duplicated monthnames and year that is giving me a problem.

Anyone can help?
 
This should work..
<%
Dim strSplitDate, strMonth, strYear


'db conn

Response.Write &quot;<select name=&quot;&quot;select&quot;&quot;>&quot;

Do while not rs.eof

strSplitDate = Split(rs(&quot;date&quot;), &quot;/&quot;)

strMonth = MonthName(strSplitDate(0)
strYear = strSplitDate(2)

Response.Write &quot;<option value=&quot;&quot;&quot; & rs(&quot;date&quot;) & &quot;&quot;&quot;>&quot; & strMonth & &quot; &quot; & strYear & &quot;</option>&quot;


rs.movenext
loop
Response.Write &quot;</select>&quot;
%>
 
oops here it is again.. i forgot a &quot;(&quot;

Code:
<%
'# Declare variables
Dim strSplitDate, strMonth, strYear

'db conn here

Response.Write &quot;<select name=&quot;&quot;select&quot;&quot;>&quot;

 Do while not rs.eof 

 strSplitDate = Split(rs(&quot;date&quot;), &quot;/&quot;)  '# Split at /

strMonth = MonthName(strSplitDate(0))
strYear = strSplitDate(2)

Response.Write &quot;<option value=&quot;&quot;&quot; & rs(&quot;date&quot;) & &quot;&quot;&quot;>&quot; & strMonth & &quot; &quot; & strYear & &quot;</option>&quot;


rs.movenext
loop
Response.Write &quot;</select>&quot;
%>
 
select month(test_date), year(test_date)
from testdatetable
group by year(test_date), month(test_date)
codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top