?? frmstsi.frm
字號(hào):
Height = 255
Index = 4
Left = 4320
TabIndex = 24
Top = 600
Visible = 0 'False
Width = 855
End
Begin VB.Label Label2
Caption = "在此輸入出生日期"
Height = 255
Index = 3
Left = 3240
TabIndex = 23
Top = 600
Visible = 0 'False
Width = 855
End
Begin VB.Label Label2
Caption = "在此選擇學(xué)生性別"
Height = 255
Index = 2
Left = 2280
TabIndex = 22
Top = 600
Visible = 0 'False
Width = 855
End
Begin VB.Label Label2
Caption = "在此輸入學(xué)生姓名"
Height = 255
Index = 1
Left = 1200
TabIndex = 21
Top = 600
Visible = 0 'False
Width = 855
End
Begin VB.Label Label2
Caption = "在此輸入學(xué)生學(xué)號(hào)"
Height = 255
Index = 0
Left = 120
TabIndex = 20
Top = 600
Visible = 0 'False
Width = 855
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 刪 除"
ForeColor = &H80000008&
Height = 375
Index = 3
Left = 3720
TabIndex = 13
Top = 0
Width = 1215
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 修 改"
ForeColor = &H80000008&
Height = 375
Index = 2
Left = 2520
TabIndex = 12
Top = 0
Width = 1215
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 查 詢"
ForeColor = &H80000008&
Height = 375
Index = 1
Left = 1320
TabIndex = 11
Top = 0
Width = 1215
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 1 'Fixed Single
Caption = " 添 加"
ForeColor = &H80000008&
Height = 375
Index = 0
Left = 120
TabIndex = 10
Top = 0
Width = 1215
End
End
Attribute VB_Name = "frmstsi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim tSQL As String
Private Sub Combo1_Click()
Text1(4) = Combo1.Text
If Label1(3).BackColor <> &HFFFFFF Then
If Label2(4).Caption = Combo1.Text Then
Combo1.BackColor = &HE0E0E0
Else
Combo1.BackColor = &HFFFFFF
End If
End If
End Sub
Private Sub Command1_Click()
Dim txtSQL As String
For i = 0 To 7
If i <> 4 Then
If Text1(i) = Label2(i).Caption Then
MsgBox "請(qǐng)" & Label2(i).Caption & "!", vbOKOnly, "提示"
Text1(i).SetFocus
Exit Sub
End If
Else
If Text1(i) = Label2(i).Caption Then
MsgBox "請(qǐng)" & Label2(i).Caption & "!", vbOKOnly, "提示"
Combo1.SetFocus
Exit Sub
End If
End If
Next
If IsDate(Text1(3)) = False Then
MsgBox "出生日期應(yīng)為日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(3).SetFocus
Exit Sub
End If
If IsDate(Text1(6)) = False Then
MsgBox "入學(xué)日期應(yīng)為日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(6).SetFocus
Exit Sub
End If
txtSQL = "select * from student_Form where student_NO='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "學(xué)號(hào)不能重復(fù)!", vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
mrc.Close
txtSQL = "select * from student_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0))
mrc.Fields(1) = Trim(Text1(1))
mrc.Fields(2) = Trim(Text1(2))
mrc.Fields(3) = Trim(Text1(3))
mrc.Fields(4) = Trim(Text1(4))
mrc.Fields(5) = Trim(Text1(5))
mrc.Fields(6) = Trim(Text1(6))
mrc.Fields(7) = Trim(Text1(7))
If Text1(8) = Label2(8).Caption Then
mrc.Fields(8) = ""
Else
mrc.Fields(8) = Trim(Text1(8))
End If
mrc.Update
mrc.Close
MsgBox "學(xué)籍信息添加成功!", vbOKOnly, "提示"
With MSFlexGrid1
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = Trim(Text1(0))
.TextMatrix(.Rows - 1, 1) = Trim(Text1(1))
.TextMatrix(.Rows - 1, 2) = Trim(Text1(2))
.TextMatrix(.Rows - 1, 3) = Trim(Text1(3))
.TextMatrix(.Rows - 1, 4) = Trim(Text1(4))
.TextMatrix(.Rows - 1, 5) = Trim(Text1(5))
.TextMatrix(.Rows - 1, 6) = Trim(Text1(6))
.TextMatrix(.Rows - 1, 7) = Trim(Text1(7))
If Text1(8) <> Label2(8).Caption Then
.TextMatrix(.Rows - 1, 8) = Trim(Text1(8))
End If
End With
MSFlexGrid1.TopRow = MSFlexGrid1.Rows - 1
TextDcolor
End Sub
Private Sub Command2_Click()
Dim j As Integer
Dim txtSQL As String
If Text1(5) <> Label2(5).Caption Then
If IsDate(Text1(5)) = False Then
MsgBox "起始日期應(yīng)為日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(5).SetFocus
Exit Sub
Else
Text1(5) = Format(Text1(5), "yyyy-mm-dd")
End If
End If
If Text1(6) <> Label2(6).Caption Then
If IsDate(Text1(6)) = False Then
MsgBox "起始日期應(yīng)為日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(6).SetFocus
Exit Sub
Else
Text1(6) = Format(Text1(6), "yyyy-mm-dd")
End If
End If
txtSQL = "select * from student_Form"
If Text1(0) <> Label2(0).Caption Then
txtSQL = txtSQL & " where student_NO='" & Trim(Text1(0)) & "'"
End If
If Text1(1) <> Label2(1).Caption Then
If txtSQL = "select * from student_Form" Then
txtSQL = txtSQL & " where student_Name='" & Trim(Text1(1)) & "'"
Else
txtSQL = txtSQL & " and student_Name='" & Trim(Text1(1)) & "'"
End If
End If
If Text1(4) <> Label2(4).Caption Then
If txtSQL = "select * from student_Form" Then
txtSQL = txtSQL & " where student_Cla='" & Trim(Text1(4)) & "'"
Else
txtSQL = txtSQL & " and student_Cla='" & Trim(Text1(4)) & "'"
End If
End If
If Text1(5) <> Label2(5).Caption And Text1(6) <> Label2(6).Caption Then
If txtSQL = "select * from student_Form" Then
txtSQL = txtSQL & " where Format(student_Esd,'yyyy-mm-dd') >='" & Trim(Text1(5)) & "'and Format(student_Esd,'yyyy-mm-dd') <='" & Trim(Text1(6)) & "'"
Else
txtSQL = txtSQL & " and Format(student_Esd,'yyyy-mm-dd') >='" & Trim(Text1(5)) & "'and Format(student_Esd,'yyyy-mm-dd') <='" & Trim(Text1(6)) & "'"
End If
End If
Set mrc = ExecuteSQL(txtSQL, MsgText)
j = 1
Do While Not mrc.EOF
j = j + 1
mrc.MoveNext
Loop
ProgressBar1.Visible = True
ProgressBar1.Min = CInt(0)
ProgressBar1.Max = CInt(j)
Set mrc = ExecuteSQL(txtSQL, MsgText)
Frame1.Visible = True
With MSFlexGrid1
.Visible = False
.Rows = 1
ProgressBar1.Value = .Rows
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 0 To mrc.Fields.Count - 1
Select Case mrc.Fields(i).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(mrc.Fields(i) & "", "yyyy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = mrc.Fields(i) & ""
End Select
Next i
mrc.MoveNext
Loop
.Visible = True
End With
Frame1.Visible = False
mrc.Close
TextDcolor
Text1(4).Visible = True
Combo1.Visible = False
Text1(2).Enabled = False
Text1(3).Enabled = False
Text1(7).Enabled = False
Text1(8).Enabled = False
End Sub
Private Sub Command3_Click()
Dim txtSQL As String
Dim j As Integer
For i = 0 To 7
If i <> 4 Then
If Text1(i) = Label2(i).Caption Then
MsgBox "請(qǐng)" & Label2(i).Caption & "!", vbOKOnly, "提示"
Text1(i).SetFocus
Exit Sub
End If
Else
If Text1(i) = Label2(i).Caption Then
MsgBox "請(qǐng)" & Label2(i).Caption & "!", vbOKOnly, "提示"
Combo1.SetFocus
Exit Sub
End If
End If
Next
If IsDate(Text1(3)) = False Then
MsgBox "出生日期應(yīng)為日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(3).SetFocus
Exit Sub
End If
If IsDate(Text1(6)) = False Then
MsgBox "入學(xué)日期應(yīng)為日期格式(yyyy-mm-dd)!", vbOKOnly, "警告"
Text1(6).SetFocus
Exit Sub
End If
txtSQL = "delete from student_Form where student_NO='" & Trim(Text1(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
txtSQL = "select * from student_Form"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = Trim(Text1(0))
mrc.Fields(1) = Trim(Text1(1))
mrc.Fields(2) = Trim(Text1(2))
mrc.Fields(3) = Trim(Text1(3))
mrc.Fields(4) = Trim(Text1(4))
mrc.Fields(5) = Trim(Text1(5))
mrc.Fields(6) = Trim(Text1(6))
mrc.Fields(7) = Trim(Text1(7))
If Text1(8) = Label2(8).Caption Then
mrc.Fields(8) = ""
Else
mrc.Fields(8) = Trim(Text1(8))
End If
mrc.Update
mrc.Close
MsgBox "學(xué)籍信息修改成功!", vbOKOnly, "提示"
j = 0
For i = 1 To MSFlexGrid1.Rows - 1
If MSFlexGrid1.TextMatrix(i, 0) = Text1(0) Then
j = i
End If
Next
If j <> 0 Then
MSFlexGrid1.TextMatrix(j, 0) = Trim(Text1(0))
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -