📄 frmtianjiaxuejixinxi.frm
字号:
VERSION 5.00
Begin VB.Form frmtianjiaxuejixinxi
Caption = "添加学籍信息"
ClientHeight = 4305
ClientLeft = 60
ClientTop = 450
ClientWidth = 6705
LinkTopic = "Form1"
ScaleHeight = 4305
ScaleWidth = 6705
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Cmdclear
Caption = "清空"
Height = 495
Left = 4920
TabIndex = 20
Top = 3720
Width = 1335
End
Begin VB.CommandButton Cmdcancel
Caption = "取消"
Height = 495
Left = 2880
TabIndex = 19
Top = 3720
Width = 1335
End
Begin VB.CommandButton cmdok
Caption = "确认"
Height = 375
Left = 360
TabIndex = 18
Top = 3720
Width = 1695
End
Begin VB.TextBox Txtcomment
Height = 735
Left = 1560
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 17
Top = 2640
Width = 1215
End
Begin VB.TextBox Txtaddress
Height = 975
Left = 5040
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 16
Top = 2400
Width = 1215
End
Begin VB.TextBox Txtphone
Height = 375
Left = 4800
TabIndex = 15
Top = 1680
Width = 1215
End
Begin VB.TextBox Txtbirthday
Height = 375
Left = 4800
TabIndex = 14
Top = 840
Width = 1215
End
Begin VB.TextBox Txtname
Height = 375
Left = 4800
TabIndex = 13
Top = 120
Width = 1215
End
Begin VB.TextBox txtdate
Height = 375
Left = 1680
TabIndex = 12
Top = 1920
Width = 1215
End
Begin VB.ComboBox Cboclassnumber
Height = 300
Left = 1680
TabIndex = 11
Top = 1320
Width = 1095
End
Begin VB.ComboBox Cbogender
Height = 300
Left = 1680
TabIndex = 10
Top = 720
Width = 1095
End
Begin VB.TextBox txtid
Height = 375
Left = 1560
TabIndex = 9
Top = 120
Width = 1575
End
Begin VB.Label Label9
Caption = "家庭地址"
Height = 495
Left = 3360
TabIndex = 8
Top = 2520
Width = 1695
End
Begin VB.Label Label8
Caption = "联系电话"
Height = 375
Left = 3360
TabIndex = 7
Top = 1560
Width = 1335
End
Begin VB.Label Label7
Caption = "出生日期"
Height = 375
Left = 3360
TabIndex = 6
Top = 840
Width = 1095
End
Begin VB.Label Label6
Caption = "姓名"
Height = 255
Left = 3480
TabIndex = 5
Top = 120
Width = 735
End
Begin VB.Label Label5
Caption = "备注"
Height = 375
Left = 360
TabIndex = 4
Top = 2760
Width = 855
End
Begin VB.Label Label4
Caption = "入校时间"
Height = 375
Left = 240
TabIndex = 3
Top = 2160
Width = 975
End
Begin VB.Label Label3
Caption = "班级"
Height = 375
Left = 480
TabIndex = 2
Top = 1440
Width = 855
End
Begin VB.Label Label2
Caption = "性别"
Height = 375
Left = 480
TabIndex = 1
Top = 720
Width = 855
End
Begin VB.Label Label1
Caption = "学号"
Height = 255
Left = 480
TabIndex = 0
Top = 120
Width = 735
End
End
Attribute VB_Name = "frmtianjiaxuejixinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmdcancel_Click()
frmmain.StatusBarmy.Panels.Item(1) = ""
Unload Me
End Sub
Private Sub Cmdclear_Click()
frmmain.StatusBarmy.Panels.Item(1) = ""
txtid.Text = ""
Txtname.Text = ""
Txtbirthday.Text = ""
Txtphone.Text = ""
txtdate.Text = ""
txtdate.Text = ""
Txtaddress.Text = ""
Txtcomment.Text = ""
End Sub
Private Sub cmdok_Click()
Dim mrc As ADODB.Recordset
Dim txtsql As String
Dim msgtext As String
If Not testtxt(txtid.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请输入学号"
End If
If Not testtxt(Txtname.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请输入姓名"
End If
If Not testtxt(Cbogender.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请选择性别"
End If
If Not testtxt(Txtbirthday.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请输入出生日期"
End If
If Not testtxt(Cboclassnumber.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请选择班级"
End If
If Not testtxt(Txtphone.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请输入联系电话"
End If
If Not testtxt(txtdate.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请输入入校时间"
End If
If Not testtxt(Txtaddress.Text) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "请输入家庭地址"
End If
If Not IsNumeric(Trim(Txtphone.Text)) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "电话号码应该是数字"
Txtphone.SelStart = 0
Txtphone.SelLength = Len(Txtphone.Text)
Txtphone.SetFocus
Txtphone.Text = ""
Exit Sub
End If
If Not IsNumeric(Trim(txtid.Text)) Then
frmmain.StatusBarmy.Panels.Item(1).Text = "学号应该是数字"
txtid.SelStart = 0
txtid.SelLength = Len(txtid.Text)
txtid.SetFocus
txtid.Text = ""
Exit Sub
End If
If Not IsDate(Trim(Txtbirthday.Text)) Then
MsgBox "出生日期输入有误" & Chr(13) & "举列(2003-08-04)", vbOKOnly + vbExclamation, "提示"
Txtbirthday.SelStart = 0
Txtbirthday.SelLength = Len(Txtbirthday.Text)
Txtbirthday.SetFocus
Exit Sub
Else
Txtbirthday = Format(Txtbirthday, "yyyy-mm-dd")
End If
If Not IsDate(Trim(txtdate.Text)) Then
MsgBox "入校日期有误" & Chr(13) & "举列(2004-4-14)", vbOKOnly + vbExclamation, "提示"
txtdate.SelStart = 0
txtdate.SelLength = Len(txtdate.Text)
txtdate.SetFocus
txtdate.Text = ""
Exit Sub
Else
txtdate = Format(txtdate, "yyyy-mm-dd")
End If
txtsql = "select * from student_info where student_id='" & Trim(txtid.Text) & "' and class_no='" & Trim(Cboclassnumber.Text) & "'"
Set mrc = executesql(txtsql, msgtext)
If Not mrc.EOF Then
frmmain.StatusBarmy.Panels.Item(1).Text = "该班级中已经存在此学号,请重新输入"
mrc.Close
txtid.SetFocus
txtid.SelStart = 0
txtid.SelLength = Len(txtid.Text)
Exit Sub
Else
mrc.AddNew
mrc.Fields(0) = Trim(txtid.Text)
mrc.Fields(1) = Trim(Txtname.Text)
mrc.Fields(2) = Trim(Cbogender.Text)
mrc.Fields("born_date") = Trim(Txtbirthday.Text)
mrc.Fields(4) = Trim(Cboclassnumber.Text)
mrc.Fields(5) = Trim(Txtphone.Text)
mrc.Fields(6) = Trim(txtdate.Text)
mrc.Fields(7) = Trim(Txtaddress.Text)
mrc.Fields(8) = Trim(Txtcomment.Text)
mrc.Update
frmmain.StatusBarmy.Panels.Item(1).Text = "添加学籍信息成功!"
mrc.Close
End If
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset, txtsql As String, msgtext As String, i As Integer
Cbogender.AddItem ""
Cbogender.AddItem "男"
Cbogender.AddItem "女"
txtsql = "select * from class_info"
Set mrc = executesql(txtsql, msgtext)
'mrc.MoveFirst
Cboclassnumber.AddItem ""
For i = 1 To mrc.RecordCount
Cboclassnumber.AddItem mrc.Fields(0)
mrc.MoveNext
Next
mrc.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -