📄 frmstudent.frm
字号:
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
FillColor = &H008080FF&
ForeColor = &H80000008&
Height = 375
Left = 660
ScaleHeight = 345
ScaleWidth = 8145
TabIndex = 34
Top = 510
Visible = 0 'False
Width = 8175
Begin VB.PictureBox picStatBox
Appearance = 0 'Flat
BackColor = &H00E0E0E0&
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 300
Left = 90
ScaleHeight = 300
ScaleWidth = 7995
TabIndex = 35
Top = 30
Width = 7995
Begin VB.CommandButton cmdFirst
BackColor = &H00C0C0C0&
Height = 300
Left = 0
Picture = "frmStudent.frx":46793
Style = 1 'Graphical
TabIndex = 39
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.CommandButton cmdPrevious
BackColor = &H00C0C0C0&
Height = 300
Left = 345
Picture = "frmStudent.frx":46AD5
Style = 1 'Graphical
TabIndex = 38
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.CommandButton cmdNext
BackColor = &H00C0C0C0&
Height = 300
Left = 7260
Picture = "frmStudent.frx":46E17
Style = 1 'Graphical
TabIndex = 37
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.CommandButton cmdLast
BackColor = &H00C0C0C0&
Height = 300
Left = 7605
Picture = "frmStudent.frx":47159
Style = 1 'Graphical
TabIndex = 36
Top = 0
UseMaskColor = -1 'True
Width = 345
End
Begin VB.Label lblStatus
Alignment = 2 'Center
BackColor = &H00FFFFFF&
BorderStyle = 1 'Fixed Single
Height = 285
Left = 690
TabIndex = 40
Top = -480
Width = 6585
End
End
End
End
End
End
Attribute VB_Name = "frmStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Hw As Boolean
Dim B As Integer
Dim WithEvents Rs As ADODB.Recordset
Attribute Rs.VB_VarHelpID = -1
Dim rsgrid As New ADODB.Recordset
Dim RsCombo As New ADODB.Recordset
Public rsQuali As New ADODB.Recordset
Dim L As Boolean
Dim Mv As Variant
Dim C As Boolean
Dim W As String
Dim s_no As Double
Dim Po As Double
Dim Hq As String
Dim SS As String
Private Sub Check1_Click()
End Sub
Private Sub Ce_Click()
If Ce.Value = True Then
cmbCour.ListIndex = -1
text1.Text = ""
SS = "select stud_id,Name,Father_name,Address,interviewby from student"
SetGridData (SS)
End If
End Sub
Private Sub cmbCour_Click()
On Error Resume Next
If cmbCour.ListIndex <> -1 Then
text1.Text = ""
Ce.Value = False
SS = "select stud_id,Name,Father_name,Address,interviewby from student" + _
" Where Course_id = " & cmbCour.ItemData(cmbCour.ListIndex)
SetGridData (SS)
End If
End Sub
Private Sub cmbCourse_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub cmdAddNew_Click()
If Not Rs.EOF Or Not Rs.BOF Then
Mv = Rs.Bookmark
End If
EnableButtons
Rs.AddNew
lblBtn1_Click
ST.TabEnabled(1) = False
cmbCourse.SetFocus
DT(0).Value = Date
T(18).Text = AutoNumber + 1
DT(1).Year = Year(Date) - 20
DT(2).Value = Date
T(15).Text = frmOptions.MT1.Text
'T(19).Text = "__-__-____"
SecondGridData
End Sub
Private Sub cmdCancel_Click()
On Error Resume Next
Rs.CancelUpdate
If Mv > 0 Then
Rs.Bookmark = Mv
Else
Rs.Requery
End If
DisableButtons
SecondGridData
ST.TabEnabled(1) = True
End Sub
Private Sub cmdClear_Click()
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
End Sub
Private Sub cmdDel_Click()
If rsQuali.RecordCount = 0 Then MsgBox "There is no record", vbInformation, App.Comments: Exit Sub
If rsQuali.RecordCount = 1 Then MsgBox "There Must be at least One qualification In the table", vbInformation, App.Comments: Exit Sub
hj = MsgBox("Are you sure You want to delete the record", vbYesNo + vbInformation, App.Comments)
If hj = vbYes Then
frmMain.Cn.Execute "Delete from qualification where degree = '" & Hq & _
"' and stud_id = " & Po
End If
SecondGridData
End Sub
Private Sub cmdDelete_Click()
MsgBox "Because this of Physical Command So it can not be provided to you"
End Sub
Private Sub cmdEdit_Click()
EnableButtons
lblStatus.Caption = "Editing Record....."
End Sub
Private Sub cmdexit_Click()
Unload frmStudent
End Sub
Private Sub cmdFind_Click()
Rs.Requery
U = InputBox("Enter the ID which you want to search")
Rs.Find "stud_id=" & Val(U), 0, adSearchForward, 1
If Rs.EOF Then
Rs.Requery
MsgBox "No match Found...", vbInformation, App.Comments
End If
SecondGridData
End Sub
Private Sub cmdFirst_Click()
Rs.MoveFirst
SecondGridData
End Sub
Private Sub cmdLast_Click()
Rs.MoveLast
SecondGridData
End Sub
Private Sub cmdNext_Click()
Rs.MoveNext
SecondGridData
If Rs.EOF Then
Rs.MoveLast
MsgBox "YOU ARE AT THE LAST RECORD ", vbInformation, App.Comments
End If
End Sub
Private Sub cmdPrevious_Click()
Rs.MovePrevious
If Rs.BOF Then
Rs.MoveFirst
MsgBox "YOU ARE AT THE FIRST RECORD ", vbInformation, App.Comments
End If
SecondGridData
End Sub
Private Sub cmdPrint_Click()
frmStudReport.Show , frmMain
End Sub
Private Sub cmdSa_Click()
On Error GoTo 1
CheckIt
If Hw = True Then Exit Sub
m = Combo1.Text
N = Combo2.Text
o = Combo3.Text
p = Combo4.Text
q = Combo5.Text
If C = True Then
frmMain.Cn.Execute "insert into qualification values(" & "'" & _
m & "','" & N & "','" & o & "','" & p & "','" & q & "'," & T(18).Text & ")"
Else
frmMain.Cn.Execute "update qualification set degree ='" & m & _
"',university ='" & N & "',division ='" & o & "',p_year='" & p & _
"',subjects='" & q & "' where degree ='" & W & "' and stud_id= " & s_no
C = True
End If
ST.TabEnabled(1) = True
SecondGridData
ButtFrame.Enabled = True
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Rs.Fields.Refresh
Exit Sub
1:
MsgBox Err.Number & vbCrLf & Err.Description, vbInformation, App.Comments
End Sub
Private Sub cmdSave_Click()
' On Error GoTo 1
CheckValidate
If L = True Then Exit Sub
Rs.UpdateBatch adAffectCurrent
'RS.Requery
'RS.MoveLast
DisableButtons
SecondGridData
SetGridData (SS)
If rsQuali.RecordCount = 0 Then
ButtFrame.Enabled = False
ST.TabEnabled(1) = False
lblBtn3_Click
End If
Exit Sub
1:
MsgBox Err.Description, vbInformation, App.Comments
End Sub
Private Sub Command1_Click()
Rs.MovePrevious
If Rs.BOF Then
MsgBox ("First Record"), vbInformation
Rs.MoveFirst
End If
SecondGridData
End Sub
Private Sub Combo4_LostFocus()
If Not IsNumeric(Combo4.Text) Then
MsgBox "There Must be Some Numeric Because YEAR can not be in Alphabet", vbInformation, App.Comments
Combo4.SetFocus
SendKeys "{home}+{end}"
Exit Sub
End If
If Len(Combo4.Text) < 4 Or Len(Combo4.Text) > 4 Then
MsgBox "Length can't Less or Exceed from 4 words", vbInformation, App.Comments
Combo4.SetFocus
SendKeys "{home}+{end}"
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Rs.MoveNext
If Rs.EOF Then
MsgBox ("Last Record"), vbInformation
Rs.MoveLast
End If
SecondGridData
End Sub
Private Sub DT_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If Index = 1 And KeyCode = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub DT_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
End If
End Sub
Private Sub Form_Load()
'frmMain.La(0).Visible = True
Set Rs = New ADODB.Recordset
If Rs.State = 1 Then Rs.Close
Rs.CursorLocation = adUseClient
Rs.Open "STUDENT", frmMain.Cn, adOpenKeyset, adLockOptimistic
SS = "select stud_id,Name,Father_name,Address,interviewby from student"
SetGridData (SS)
'this will map all the fields with the database and the textboxes
SetDataSources
LoadInCombo
For i = 0 To Rs.Fields.Count - 1
Grid.ColWidth(i) = GetSetting(App.EXEName, "Grid", "grid" & i, 1200)
Next
QualiWidth
SecondGridData
C = True
L = False
ShowCourses
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -