Drop-down with 5 next years

A

Augie Dawg

I've been scratching my head a bit on how to do this, and sure could use
some ideas. I'd like to offer the user a drop-down containing the current
year and five years out, but I don't want to use a static, or hard-coded
drop down because I'm sure I'll forget to update the contents when 2006
rolls around. I know how to use a DRW to generate a dynamic drop-down, but
I'm stuck on the SQL that will generate only the current and next five
years. I thought of creating a table that has all the ensuing years and
then using something like

SELECT TOP 5 Years WHERE Year > DatePart('YYYY',NOW())

but I'm pretty sure this won't work. Any other ideas?

Thanks!

A.D.
 
J

Jim Buyens

Try this:

<select size="1" name="year">
<option><%=year(now)%></option>
<option><%=year(now)+1%></option>
<option><%=year(now)+2%></option>
<option><%=year(now)+3%></option>
<option><%=year(now)+4%></option>
</select>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top