?? +i
字號:
if isdate(endyearno.value+"/"+monthendno.value+"/"+daysendno.value) then
else
msgbox "對不起!此終止日期格式輸入錯誤,請重新輸入",,"提示窗口"
start_input.disabled = false
save_input.disabled = true
cancel_input.disabled = true
EXIT SUB
end if
' msgbox cdate(rtrim(yearno.value +"/"+monthstartno.value+"/"+daystartno.value)) < cdate(rtrim(yearno.value +"/"+monthendno.value+"/"+daySendno.value))
if cdate(rtrim(yearno.value +"/"+monthstartno.value+"/"+daystartno.value)) > cdate(rtrim(endyearno.value +"/"+monthendno.value+"/"+daySendno.value)) then
msgbox "終止日期不能小于起始日期",,"提示窗口"
exit sub
end if
datestart=rtrim(yearno.value +"/"+monthstartno.value+"/"+daystartno.value)
dateend=rtrim(endyearno.value +"/"+monthendno.value+"/"+daysendno.value)
end if
if len(rtrim(startno.value)) > 0 then
if len(rtrim(endno.value)) > 0 then
if rtrim(endno.value) < rtrim(startno.value) then
msgbox "終止學號必須不小于起始學號!"
start_input.disabled = false
save_input.disabled = true
cancel_input.disabled = true
exit sub
end if
else
endno.value = startno.value
end if
end if
' if len(trim(classno.value))<>0 then
'rds1.SQL="select 班號,請假=SUM(請假),曠課=SUM(曠課),遲到=SUM(遲到),早退=SUM(早退) from dailymanage where 班號='"&classno.value&"' and convert(int,第幾周)>="&int(weekstartno.value)&" and convert(int,第幾周)<="&int(weekendno.value)&""&_
'"and convert(datetime,日期)>=convert(datetime,'"&datestart&"') and convert(datetime,日期)<=convert(datetime,'"&dateend&"') GROUP BY 班號 "
'rds1.ExecuteOptions = 1
' rds1.Refresh
if len(rtrim(weekstartno.value))>0 then
rds1.SQL="select 班號,請假=SUM(請假),曠課=SUM(曠課),遲到=SUM(遲到),早退=SUM(早退) from dailymanage where convert(int,第幾周)>="&int(weekstartno.value)&" and convert(int,第幾周)<="&int(weekendno.value)&""&_
" and 學期='"&termno.value&"' GROUP BY 班號 " '班號='"&classno.value&"' and
rds1.ExecuteOptions = 1
rds1.Refresh
if rds1.Recordset.recordcount<=0 then
msgbox "沒有找到滿足此條件的數(shù)據(jù)!",,"提示窗口"
exit sub
else
class_print.disabled = false
end if
else
rds1.SQL="select 班號,請假=SUM(請假),曠課=SUM(曠課),遲到=SUM(遲到),早退=SUM(早退) from dailymanage where 學期='"&termno.value&"' "&_
"and convert(datetime,日期)>=convert(datetime,'"&datestart&"') and convert(datetime,日期)<=convert(datetime,'"&dateend&"') GROUP BY 班號 " '班號='"&classno.value&"' and
rds1.ExecuteOptions = 1
rds1.Refresh
if rds1.Recordset.recordcount<=0 then
msgbox "沒有找到滿足此條件的數(shù)據(jù)!",,"提示窗口"
exit sub
else
class_print.disabled = false
end if
end if
' else
' msgbox "請先輸入班號!",,"提示窗口"
' end if
end sub
' print student
'==================================================================
'按學號進行打印
sub printno()
if rds1.Recordset.recordcount<=0 then
exit sub
end if
student_print.disabled = true
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
'j=0
rds1.Recordset.movefirst
while not rds1.Recordset.eof
'for k=j+1 to j+21
for y=0 to 5
select case y
case 0
k=1
case 1
k=24
case 2
k=48
case 3
k=72
case 4
k=96
case 5
k=120
end select
if len(rtrim(weekstartno.value))>0 then
xlSheet.Cells(k, 10) = yearno.value+"-"+endyearno.value+"學年度"+termno.value+"第"+weekstartno.value+"、"+weekendno.value+"周"
xlSheet.Cells(k+1,10) ="海南省瓊海師范學校學生考勤情況統(tǒng)計表"
else
xlSheet.Cells(k, 10) = yearno.value+"-"+endyearno.value+"學年度"+termno.value+"("+yearno.value+"年"+monthstartno.value+"月"+daystartno.value+"日"+"--"+monthendno.value+"月"+daysendno.value+"日)"
xlSheet.Cells(k+1,10) ="海南省瓊海師范學校學生考勤情況統(tǒng)計表"
end if
for i=0 to 3
'當I=0時及第一次印時,則行已固定
if i=0 then
' msgbox rds1.Recordset.fields(0).name
xlsheet.cells(k+2,2)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,3)=rds1.Recordset.fields(2).name
xlsheet.cells(k+2,4)=rds1.Recordset.fields(3).name+"(節(jié))"
xlsheet.cells(k+2,5)=rds1.Recordset.fields(4).name+"(節(jié))"
xlsheet.cells(k+2,6)=rds1.Recordset.fields(5).name+"(次)"
xlsheet.cells(k+2,7)=rds1.Recordset.fields(6).name+"(次)"
end if
'//////////
if i=1 then
' msgbox k+2
xlsheet.cells(k+2,8)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,9)=rds1.Recordset.fields(2).name
xlsheet.cells(k+2,10)=rds1.Recordset.fields(3).name+"(節(jié))"
xlsheet.cells(k+2,11)=rds1.Recordset.fields(4).name+"(節(jié))"
xlsheet.cells(k+2,12)=rds1.Recordset.fields(5).name+"(次)"
xlsheet.cells(k+2,13)=rds1.Recordset.fields(6).name+"(次)"
end if
'///////////////////////
if i=2 then
xlsheet.cells(k+2,14)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,15)=rds1.Recordset.fields(2).name
xlsheet.cells(k+2,16)=rds1.Recordset.fields(3).name+"(節(jié))"
xlsheet.cells(k+2,17)=rds1.Recordset.fields(4).name+"(節(jié))"
xlsheet.cells(k+2,18)=rds1.Recordset.fields(5).name+"(次)"
xlsheet.cells(k+2,19)=rds1.Recordset.fields(6).name+"(次)"
end if
'//////////////////////
if i=3 then
xlsheet.cells(k+2,20)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,21)=rds1.Recordset.fields(2).name
xlsheet.cells(k+2,22)=rds1.Recordset.fields(3).name+"(節(jié))"
xlsheet.cells(k+2,23)=rds1.Recordset.fields(4).name+"(節(jié))"
xlsheet.cells(k+2,24)=rds1.Recordset.fields(5).name+"(次)"
xlsheet.cells(k+2,25)=rds1.Recordset.fields(6).name+"(次)"
end if
'//////////////
for j=0 to 19
if rds1.Recordset.eof=true then
exit sub
end if
if i=0 then
If isnull(rds1.Recordset.fields(0))=false then ' isnull(rds1.Recordset.fields(0))=false
if rds1.Recordset.fields(0)=oldclass then
else
if IsNumeric(rds1.Recordset.fields(0)) = true Then
xlSheet.Cells(k+3,2) = trim(cstr(rds1.Recordset.fields(0)))
else
xlSheet.Cells(k+3,2) = trim(cstr(rds1.Recordset.fields(0)))
End If
end if
end if
'====================
If isnull(rds1.Recordset.fields(2))=false then
if IsNumeric(rds1.Recordset.fields(2)) = true Then
xlSheet.Cells(k+3,3) = trim(cstr(rds1.Recordset.fields(2)))
else
xlSheet.Cells(k+3,3) = trim(cstr(rds1.Recordset.fields(2)))
End If
end if
'=============================
If rds1.Recordset.fields(3)<>0 then ' isnull(rds1.Recordset.fields(3))=false
if IsNumeric(rds1.Recordset.fields(3)) = true Then
xlSheet.Cells(k+3,4) = trim(cstr(rds1.Recordset.fields(3)))
else
xlSheet.Cells(k+3,4) = trim(cstr(rds1.Recordset.fields(3)))
End If
end if
'=================================
If rds1.Recordset.fields(4)<>0 then
' msgbox isnull(rds1.Recordset.fields(4))
if IsNumeric(rds1.Recordset.fields(4)) = true Then
xlSheet.Cells(k+3,5) = trim(cstr(rds1.Recordset.fields(4)))
else
xlSheet.Cells(k+3,5) = trim(cstr(rds1.Recordset.fields(4)))
End If
end if
'=============================
If rds1.Recordset.fields(5)<>0 then
' msgbox isnull(rds1.Recordset.fields(5))
if IsNumeric(rds1.Recordset.fields(5)) = true Then
xlSheet.Cells(k+3,6) = trim(cstr(rds1.Recordset.fields(5)))
else
xlSheet.Cells(k+3,6) = trim(cstr(rds1.Recordset.fields(5)))
End If
end if
'============================================
If rds1.Recordset.fields(6)<>0 then
' msgbox isnull(rds1.Recordset.fields(6))
if IsNumeric(rds1.Recordset.fields(6)) = true Then
xlSheet.Cells(k+3,7) = trim(cstr(rds1.Recordset.fields(6)))
else
xlSheet.Cells(k+3,7) = trim(cstr(rds1.Recordset.fields(6)))
End If
end if
end if
'==============================
if i=1 then
If isnull(rds1.Recordset.fields(0))=false then
if rds1.Recordset.fields(0)=oldclass then
else
if IsNumeric(rds1.Recordset.fields(0)) = true Then
xlSheet.Cells(k+3,8) = trim(cstr(rds1.Recordset.fields(0)))
else
xlSheet.Cells(k+3,8) = trim(cstr(rds1.Recordset.fields(0)))
End If
end if
end if
'====================
If isnull(rds1.Recordset.fields(2))=false then
if IsNumeric(rds1.Recordset.fields(2)) = true Then
xlSheet.Cells(k+3,9) = trim(cstr(rds1.Recordset.fields(2)))
else
xlSheet.Cells(k+3,9) = trim(cstr(rds1.Recordset.fields(2)))
End If
end if
'=============================
If rds1.Recordset.fields(3)<>0 then
if IsNumeric(rds1.Recordset.fields(3)) = true Then
xlSheet.Cells(k+3,10)= trim(cstr(rds1.Recordset.fields(3)))
else
xlSheet.Cells(k+3,10) = trim(cstr(rds1.Recordset.fields(3)))
End If
end if
'=================================
If rds1.Recordset.fields(4)<>0 then
' msgbox isnull(rds1.Recordset.fields(4))
if IsNumeric(rds1.Recordset.fields(4)) = true Then
xlSheet.Cells(k+3,11) = trim(cstr(rds1.Recordset.fields(4)))
else
xlSheet.Cells(k+3,11) = trim(cstr(rds1.Recordset.fields(4)))
End If
end if
'=============================
If rds1.Recordset.fields(5)<>0 then
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -