cLFlaVA,
Thanks for your help. Here's the code
<html>
<head>
<title>xxx</title>
</style>
</head>
<%
' Retrieve parameters
strmonth = request.querystring("mo")
strYear = request.querystring("yr")
if strMonth = "" then
' default to today's calendar month and year
nMonth = month(now)
strMonth = monthName(nmonth)
strYear = Year(now)
end if
if strMonth = "January" then
m1 = "selected"
elseif strMonth = "February" then
m2 = "selected"
elseif strMonth = "March" then
m3 = "selected"
elseif strMonth = "April" then
m4 = "selected"
elseif strMonth = "May" then
m5 = "selected"
elseif strMonth = "June" then
m6 = "selected"
elseif strMonth = "July" then
m7 = "selected"
elseif strMonth = "August" then
m8 = "selected"
elseif strMonth = "September" then
m9 = "selected"
elseif strMonth = "October" then
m10 = "selected"
elseif strMonth = "November" then
m11 = "selected"
elseif strMonth = "December" then
m12 = "selected"
End If
if strYear = "2005" then
y1 = "selected"
elseif strYear = "2006" then
y2 = "selected"
end if
Table_Name = "Calendar_" & strYear
' Create a command object. This object serves to run our queries
Set cnDB = Server.CreateObject("ADODB.Connection")
' The Connection string looks for a database file called database
connStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Calendar.mdb")
On error Resume Next
cnDB.Open ConnStr
' response.write "ERROR: " & err.number & " " & err.description
' Retrieve the results in a recordset object
strSEL = "[Month],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20]," & _
"[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]"
strSQL = "SELECT " & strSEL & " FROM " & Table_Name & " WHERE MONTH = '" & strMonth & "'"
Set rsDB = Server.CreateObject("ADODB.Recordset")
rsDB.Open strSQL, cnDB, 3, 3
%>
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#FFFFFF" VLINK="#FFFFFF" ALINK="#ffffff" onResize="OnWeResize()">
<form name="mycal" action="select2.asp" method="get">
<%
'<DIV CLASS=F16 STYLE="position:absolute;left:376;top:59;width:267;height:20;">text here</DIV>
%>
<select name="mo">
<option value="January" "<%=m1%>" >January</option>
<option value="February" "<%=m2%>" >February</option>
<option value="March" "<%=m3%>" >March</option>
<option value="April" "<%=m4%>" >April</option>
<option value="May" "<%=m5%>" >May</option>
<option value="June" "<%=m6%>" >June</option>
<option value="July" "<%=m7%>" >July</option>
<option value="August" "<%=m8%>" >August</option>
<option value="September" "<%=m9%>" >September</option>
<option value="October" "<%=m10%>" >October</option>
<option value="November" "<%=m11%>" >November</option>
<option value="December" "<%=m12%>" >December</option>
</select>
<select name="yr">
<option value="2005" "<%=y1%>" >2005</option>
<option value="2006" "<%=y2%>" >2006</option>
</select>
<input type="submit" name="update" class="btn" value="Update">
<p STYLE="position:relative;left:100;top:170;height:19">
<TABLE BORDER=3 CELLSPACING=3 CELLPADDING=3 class='tbl'>
<TR><TD COLSPAN="7" ALIGN='center' class='hd1'><B><%=strMonth%>, <%=strYear%></B></TD></TR>
<TR>
<TD ALIGN=center class='td1'><font class='F1'>Sun</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Mon</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Tue</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Wed</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Thu</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Fri</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Sat</font</TD>
</TR>
<%
' Write out the days of the month. if "dow" (day of week) errors, then that is an invalid date.
For I = 1 to 31
strDate = strMonth & " " & I & ", " & strYear
On Error Resume Next
dow = DatePart("w", strDate)
' This errors if the date is invalid and exits the FOR LOOP
if err.number = 13 then
exit for
end if
' This is a valid day so get the contents. If no data for this day, display a blank day
if rsDB.fields(I).value = "" or ISNULL( rsDB.fields(I).value) then
strVal = " "
else
'
' This is the actual string in the table for this day.
strVal = rsDB.fields(I).value
end if
' This line writes the date number at the top right of the calendar day
tblDay = "<table border=0 ><tr><td align='left' valign='top' width=60 height=12>" & _
"<font class='cal'>" & I & "</font></td></tr></table>"
If I = 1 then
'
Response.write "<tr valign='top'>"
xdays = 7 -(7 - dow + 1)
' If the first day of the month lands in mid-week, write blank days from Sunday till xdays.
For J = 1 to xdays
response.write "<td align='right' valign='top' width=50 height=12>" & _
"<font class='cal'>" & " " & "</font></td>"
Next
' Now write the first day
response.write "<td width=70>" & tblDay & "<center>" & strVal & "</center>" & "</font></td>"
ElseIf dow = 1 then
'
' This line writes the first day of the week (Sunday) that is not the first week of the month.
response.write "<tr valign='top'><td align='right' width=70 >" & _
tblDay & "<center>" & strVal & "</center>" & "</td>"
Elseif dow = 7 then
'
' This line writes the last day of the week (Saturday).
response.write "<td width=70>" & tblDay & strVal & "</td></tr>"
Else
' This line writes any other day of the week.
response.write "<td width=70>" & tblDay & strVal & "</td>"
End if
Next
' Close all connections
rsDB.Close
Set rdDB = Nothing
cnDB.Close
Set cnDB = Nothing
%>
</table>
</form>
</body>
</html>