📄 mainmodule.bas
字号:
Attribute VB_Name = "MainModule"
Dim j As String
Dim K As String
Public frm1 As Byte
Public frm2 As Byte
Public Sub ShowSemester(cmbSemester As ComboBox, j As Integer)
Dim RsSem As New ADODB.Recordset
v = j
SQL = "Select sections from course where course_id= " & v
cmbSemester.Clear
With RsSem
If .State = 1 Then .Close
.CursorLocation = adUseClient
.Open SQL, frmMain.Cn, adOpenDynamic, adLockOptimistic
For i = 1 To .Fields(0)
cmbSemester.AddItem "Term " & i
Next
End With
End Sub
Public Sub ShowExams(cmbExams As ComboBox)
Dim RsExam As New ADODB.Recordset
SQL = "Select * from exams "
cmbExams.Clear
With RsExam
If .State = 1 Then .Close
.CursorLocation = adUseClient
.Open SQL, frmMain.Cn, adOpenDynamic, adLockOptimistic
While Not .EOF
cmbExams.AddItem .Fields("Exam_name")
cmbExams.ItemData(cmbExams.NewIndex) = .Fields("Exam_id")
.MoveNext
Wend
End With
End Sub
Public Sub ShowCourse(cmbCourse As ComboBox)
Dim RsCourse As New ADODB.Recordset
cmbCourse.Clear
With RsCourse
If .State = 1 Then .Close
.CursorLocation = adUseClient
.Open "Select Course_id,course_Name from course", frmMain.Cn, adOpenDynamic, adLockOptimistic
While Not .EOF
cmbCourse.AddItem .Fields(1)
cmbCourse.ItemData(cmbCourse.NewIndex) = .Fields(0)
.MoveNext
Wend
End With
End Sub
Public Sub StudReport()
With DE.rsrptStudent_Grouping
If .State = 1 Then .Close
Call DE.rptStudent_Grouping(1, 1, "'Dec-2002'")
If .RecordCount = 0 Then
MsgBox "there is no record to print canceling report...", vbInformation, App.Comments
Exit Sub
End If
rptStudents.Show
End With
End Sub
Public Sub GussetReport(Ch As Integer, Ex As Integer, Sem As Integer, cour As Integer, Sess As String)
With DE.rsrptGusset_Grouping
If .State = 1 Then .Close
Call DE.rptGusset_Grouping(Ch, Ex, Sem, cour, Sess)
If .RecordCount = 0 Then
MsgBox "there is no record to print canceling report...", vbInformation, App.Comments
Exit Sub
End If
Call rptGusset.Show
End With
End Sub
Public Sub CheckMonth(t1 As MaskEdBox)
t1.Text = UCase(t1.Text)
j = Left(t1.Text, 3)
Select Case j
Case "JAN", "FEB", "MAR", "APR", "MAY", "JUN" _
, "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
Exit Sub
End Select
MsgBox "Please check the month IT should be JAN,FEB,MAR....and So on DEC", vbInformation, App.Comments
t1.SetFocus
t1.SelStart = 0
t1.SelLength = 3
End Sub
Public Sub CheckYear(t1 As MaskEdBox)
K = Right(t1.Text, 4)
Select Case K
Case "1999", "2000", "2001", "2002", "2003", "2004" _
, "2005", "2006", "2007", "2008", "2009", "2010"
Exit Sub
End Select
MsgBox "Please check the year It should be between 1999 to 2010", vbInformation, App.Comments
t1.SetFocus
t1.SelStart = 4
t1.SelLength = 4
End Sub
Public Function ChkNumericDigit(ByRef KeyAscii As Integer)
'-------------------------------------------------------------------------------------------'
'Digit Range: (0,1,2,3,4,5,6,7,8,9)
'-------------------------------------------------------------------------------------------'
Select Case KeyAscii
Case 48 To 57, 8
Exit Function
Case Else
KeyAscii = 0
End Select
ChkNumericDigit = True
Exit Function
fls:
ChkNumericDigit = False
End Function
Public Sub Dither(frm As Form)
Dim intLoop As Integer ' Counter
' Set the pen parameters
frm.DrawStyle = vbInsideSolid
frm.DrawMode = vbCopyPen
frm.ScaleMode = vbPixels
frm.DrawWidth = 5
frm.ScaleWidth = 256
frm.ScaleHeight = 256
For intLoop = 0 To 500
frm.Line (0, intLoop)-(Screen.Width, intLoop - 1), RGB(intLoop + 20, intLoop + 100, intLoop + 180), B
Next intLoop
'frm.Line (0, intLoop)-(Screen.Width, intLoop - 1), RGB(intLoop + 200, intLoop + 150, intLoop + 100), B
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -