⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jibenform.frm

📁 此文件为在VB环境下可用.且有数据库文件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓别:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   6
         Left            =   3960
         TabIndex        =   13
         Top             =   240
         Width           =   585
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓名:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   5
         Left            =   2040
         TabIndex        =   12
         Top             =   240
         Width           =   705
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "学号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   1
         Left            =   120
         TabIndex        =   10
         Top             =   240
         Width           =   585
      End
   End
   Begin VB.Frame Frame1 
      Height          =   735
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   7575
      Begin VB.ComboBox Combo4 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   6120
         TabIndex        =   8
         Top             =   240
         Width           =   1215
      End
      Begin VB.ComboBox Combo3 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   4080
         TabIndex        =   7
         Top             =   240
         Width           =   1455
      End
      Begin VB.ComboBox Combo2 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   2160
         TabIndex        =   6
         Top             =   240
         Width           =   1455
      End
      Begin VB.ComboBox Combo1 
         Appearance      =   0  'Flat
         Height          =   300
         Left            =   720
         TabIndex        =   5
         Top             =   240
         Width           =   975
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "班:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   4
         Left            =   5640
         TabIndex        =   4
         Top             =   240
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "系:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   3
         Left            =   3720
         TabIndex        =   3
         Top             =   240
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "院:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   2
         Left            =   1800
         TabIndex        =   2
         Top             =   240
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "校区:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Index           =   0
         Left            =   120
         TabIndex        =   1
         Top             =   240
         Width           =   585
      End
   End
End
Attribute VB_Name = "jibenform"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim xuehao

Private Sub Combo1_LostFocus()
sql = "select * from 学院表 where 所属校区='" & Combo1.List(Combo1.ListIndex) & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
temp = MsgBox("该校区尚未有学院注册,是否注册学院?", vbYesNo)
If temp = vbYes Then
Set rs = Nothing
Unload Me
zhuceform.Show 1
Exit Sub
End If
Set rs = Nothing
Exit Sub
End If
Combo2.Clear
i = 0
Do While Not rs.EOF
Combo2.List(i) = rs("学院名称")
i = i + 1
rs.MoveNext
Loop

Set rs = Nothing
End Sub

Private Sub Combo2_LostFocus()
If Combo1.ListIndex = -1 Then Exit Sub
sql = "select * from 系别表 where 所属校区='" & Combo1.List(Combo1.ListIndex) & "' and 所属学院='" & Combo2.List(Combo2.ListIndex) & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
temp = MsgBox("该院尚未有系注册,是否注册该系?", vbYesNo)
If temp = vbYes Then
Set rs = Nothing
Unload Me
XIBIEFORM.Show 1
Exit Sub
End If
Set rs = Nothing
Exit Sub
End If
Combo3.Clear
i = 0
Do While Not rs.EOF
Combo3.List(i) = rs("系别名称")
i = i + 1
rs.MoveNext
Loop
Set rs = Nothing
End Sub

Private Sub Combo3_LostFocus()
If Combo1.ListIndex = -1 Or Combo2.ListIndex = -1 Then Exit Sub
sql = "select * from 班级表 where 所属校区='" & Combo1.List(Combo1.ListIndex) & "' and 所属院='" & Combo2.List(Combo2.ListIndex) & "'and 所属系= '"
sql = sql & Combo3.List(Combo3.ListIndex) & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
temp = MsgBox("该系尚未有班级注册,是否注册班级?", vbYesNo)
If temp = vbYes Then
Set rs = Nothing
Unload Me
banjiform.Show 1
Exit Sub
End If
Set rs = Nothing
Exit Sub
End If
Combo4.Clear
i = 0
Do While Not rs.EOF
Combo4.List(i) = rs("班级名称")
i = i + 1
rs.MoveNext
Loop
Set rs = Nothing
End Sub

Private Sub Combo5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo6.SetFocus
End If
End Sub

Private Sub Combo6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Private Sub Command1_Click()
If Len(Text1.Text) = 0 Or Combo1.ListIndex = -1 Or Combo2.ListIndex = -1 Or Combo3.ListIndex = -1 Or Combo4.ListIndex = -1 Or Combo4.ListIndex = -1 Or Combo5.ListIndex = -1 Or Combo6.ListIndex = -1 Or Len(Label2.Text) = 0 Then
MsgBox "数据输入不全!请全部填写!"
Exit Sub
End If
    xuehao = Label2.Text
    xuehao = Val(xuehao) + 1
    
    If Len(xuehao) = 0 Then xuehao = "000000"
    If Len(xuehao) = 1 Then xuehao = "00000" & xuehao
    If Len(xuehao) = 2 Then xuehao = "0000" & xuehao
    If Len(xuehao) = 3 Then xuehao = "000" & xuehao
    If Len(xuehao) = 4 Then xuehao = "00" & xuehao
    If Len(xuehao) = 5 Then xuehao = "0" & xuehao
    Label2.Text = xuehao
sql = "select * from 基本表 where 学号='" & Label2.Text & "'"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
    
    xingming = Text1.Text
xingbie = Combo5.List(Combo5.ListIndex)
banji = Combo3.List(Combo3.ListIndex) & Combo4.List(Combo4.ListIndex)
bkdate = Date
buchongma = Combo6.List(Combo6.ListIndex)
suoshuban = Combo4.List(Combo4.ListIndex)
suoshuxi = Combo3.List(Combo3.ListIndex)
suoshuyuan = Combo2.List(Combo2.ListIndex)
suoshuxiaoqu = Combo1.List(Combo1.ListIndex)
If suoshuxiaoqu = "东校区" Then temp = 0
If suoshuxiaoqu = "西校区" Then temp = 1
If suoshuxiaoqu = "南校区" Then temp = 2
If suoshuxiaoqu = "北校区" Then temp = 3
CARDNUMBER = Combo1.ListIndex & xuehao
tiaoxingma = "*" & CARDNUMBER & buchongma & "*"
Label3.Caption = tiaoxingma
Adodc1.Recordset.AddNew
Adodc1.Recordset("学号") = xuehao
Adodc1.Recordset("姓名") = xingming
Adodc1.Recordset("性别") = xingbie
Adodc1.Recordset("班级") = banji
Adodc1.Recordset("卡号") = CARDNUMBER
Adodc1.Recordset("办卡日期") = bkdate
Adodc1.Recordset("条形码") = tiaoxingma
Adodc1.Recordset("补充码") = buchongma
Adodc1.Recordset("所属班") = suoshuban
Adodc1.Recordset("所属系") = suoshuxi
Adodc1.Recordset("所属院") = suoshuyuan
Adodc1.Recordset("所属校区") = suoshuxiaoqu
Adodc1.Recordset.Update
Adodc1.Refresh
Text1.Text = ""
Text1.SetFocus
Else
MsgBox "学号重复!请初始化学号!"
Label2.SetFocus
End If

End Sub

Private Sub Command2_Click()
temp = MsgBox("此程序只可运行一次,请谨慎决定是否运行!", vbYesNo)
If temp = vbNo Then Exit Sub
Adodc1.RecordSource = "select * from 基本表"
Adodc1.Refresh
xuehao = "000000"
Do While Not Adodc1.Recordset.EOF
    xuehao = Val(xuehao) + 1
    If Len(xuehao) = 0 Then xuehao = "000000"
    If Len(xuehao) = 1 Then xuehao = "00000" & xuehao
    If Len(xuehao) = 2 Then xuehao = "0000" & xuehao
    If Len(xuehao) = 3 Then xuehao = "000" & xuehao
    If Len(xuehao) = 4 Then xuehao = "00" & xuehao
    If Len(xuehao) = 5 Then xuehao = "0" & xuehao
    Adodc1.Recordset("学号") = xuehao
    Adodc1.Recordset("卡号") = Combo1.ListIndex & xuehao
    Adodc1.Recordset("条形码") = "*" & Combo1.ListIndex & xuehao & "0*"
    Adodc1.Recordset.Update
Adodc1.Recordset.MoveNext
Loop
End Sub

Private Sub Command3_Click()
End Sub

Private Sub Command4_Click()
If Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF Then Exit Sub
If Command4.Caption = "编辑" Then
Text1.Text = Adodc1.Recordset("姓名")
Label3.Caption = Adodc1.Recordset("条形码")
Label2.Text = Adodc1.Recordset("学号")
Text1.SetFocus
Command4.Caption = "保存"
Command1.Enabled = False
Command5.Enabled = False
Exit Sub
Else
If Len(Text1.Text) = 0 Or Combo1.ListIndex = -1 Or Combo2.ListIndex = -1 Or Combo3.ListIndex = -1 Or Combo4.ListIndex = -1 Or Combo4.ListIndex = -1 Or Combo5.ListIndex = -1 Or Combo6.ListIndex = -1 Then
MsgBox "数据输入不全!请全部填写!"
Exit Sub
End If

xingming = Text1.Text
xingbie = Combo5.List(Combo5.ListIndex)
banji = Combo3.List(Combo3.ListIndex) & Combo4.List(Combo4.ListIndex)
bkdate = Date
buchongma = Combo6.List(Combo6.ListIndex)
suoshuban = Combo4.List(Combo4.ListIndex)
suoshuxi = Combo3.List(Combo3.ListIndex)
suoshuyuan = Combo2.List(Combo2.ListIndex)
suoshuxiaoqu = Combo1.List(Combo1.ListIndex)
If suoshuxiaoqu = "东校区" Then temp = 0
If suoshuxiaoqu = "西校区" Then temp = 1
If suoshuxiaoqu = "南校区" Then temp = 2
If suoshuxiaoqu = "北校区" Then temp = 3
tiaoxingma = "*" & Adodc1.Recordset("卡号") & buchongma & "*"
Adodc1.Recordset("姓名") = xingming
Adodc1.Recordset("性别") = xingbie
Adodc1.Recordset("班级") = banji
Adodc1.Recordset("办卡日期") = bkdate
Adodc1.Recordset("条形码") = tiaoxingma
Adodc1.Recordset("补充码") = buchongma
Adodc1.Recordset("所属班") = suoshuban
Adodc1.Recordset("所属系") = suoshuxi
Adodc1.Recordset("所属院") = suoshuyuan
Adodc1.Recordset("所属校区") = suoshuxiaoqu
Adodc1.Recordset.Update
Adodc1.Refresh
Text1.Text = ""
Label2 = ""
Label3 = ""
Text1.SetFocus
Command4.Caption = "编辑"
Command1.Enabled = True
Command5.Enabled = True
End If

End Sub

Private Sub Command5_Click()
If Adodc1.Recordset.EOF Then Exit Sub
Adodc1.Recordset.Delete
Adodc1.Refresh
Label2.Text = ""
Label3.Caption = ""
End Sub

Private Sub Command6_Click()
Unload Me
End Sub

Private Sub Form_Load()
conn.Open connstr
Combo1.AddItem ("东校区")
Combo1.AddItem ("西校区")
Combo1.AddItem ("南校区")
Combo1.AddItem ("北校区")
Combo1.ListIndex = 0
Combo5.ListIndex = 0
Combo6.ListIndex = 0
brinxuehao
Label2.Text = xuehao
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set rs = Nothing
Set conn = Nothing
End Sub

Sub brinxuehao()
Set rs = Nothing
sql = "select top 1 * from 基本表  order by 学号 desc"
Set rs = conn.Execute(sql)
If rs.EOF Or rs.BOF Then
xuehao = "000000"
Else
    xuehao = rs("学号")
End If
Set rs = Nothing
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Combo5.SetFocus
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -