frmReader1.frm
资源名称:图书馆管理系统11.rar [点击查看]
上传用户:wang_li173
上传日期:2007-06-22
资源大小:43k
文件大小:19k
源码类别:
系统设计方案
开发平台:
Visual Basic
- VERSION 5.00
- Begin VB.Form frmReader1
- BorderStyle = 3 'Fixed Dialog
- Caption = "读者信息"
- ClientHeight = 4776
- ClientLeft = 48
- ClientTop = 336
- ClientWidth = 8928
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 4776
- ScaleWidth = 8928
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 'CenterOwner
- Begin VB.Frame Frame1
- Caption = "读者种类:"
- Height = 2412
- Index = 1
- Left = 240
- TabIndex = 10
- Top = 240
- Width = 2892
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 4
- Left = 1080
- Style = 2 'Dropdown List
- TabIndex = 23
- Top = 1800
- Width = 1092
- End
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 3
- Left = 1080
- Style = 2 'Dropdown List
- TabIndex = 22
- Top = 1440
- Width = 1092
- End
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 2
- Left = 1080
- Style = 2 'Dropdown List
- TabIndex = 21
- Top = 1080
- Width = 1092
- End
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 1
- Left = 1080
- Style = 2 'Dropdown List
- TabIndex = 20
- Top = 720
- Width = 1332
- End
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 0
- Left = 1080
- Style = 2 'Dropdown List
- TabIndex = 19
- Top = 360
- Width = 1332
- End
- Begin VB.Label Label2
- Caption = "借书数量:"
- Height = 255
- Index = 12
- Left = 240
- TabIndex = 18
- Top = 1080
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "有效期限:"
- Height = 252
- Index = 11
- Left = 240
- TabIndex = 17
- Top = 1800
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "种类名称:"
- Height = 255
- Index = 10
- Left = 240
- TabIndex = 16
- Top = 720
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "种类编号:"
- Height = 255
- Index = 9
- Left = 240
- TabIndex = 15
- Top = 360
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "借书期限:"
- Height = 255
- Index = 8
- Left = 240
- TabIndex = 14
- Top = 1440
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "月"
- Height = 252
- Index = 2
- Left = 2280
- TabIndex = 13
- Top = 1800
- Width = 252
- End
- Begin VB.Label Label2
- Caption = "天"
- Height = 252
- Index = 5
- Left = 2280
- TabIndex = 12
- Top = 1440
- Width = 252
- End
- Begin VB.Label Label2
- Caption = "本"
- Height = 252
- Index = 6
- Left = 2280
- TabIndex = 11
- Top = 1080
- Width = 252
- End
- End
- Begin VB.Frame Frame3
- Caption = "备注信息"
- Height = 1215
- Left = 240
- TabIndex = 6
- Top = 2760
- Width = 8532
- Begin VB.TextBox txtItem
- Height = 840
- Index = 7
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 33
- Top = 240
- Width = 8292
- End
- End
- Begin VB.Frame Frame1
- Caption = "读者信息"
- Height = 2412
- Index = 0
- Left = 3240
- TabIndex = 2
- Top = 240
- Width = 5532
- Begin VB.ComboBox cboItem
- Height = 288
- Index = 5
- Left = 1200
- Style = 2 'Dropdown List
- TabIndex = 34
- Top = 1200
- Width = 1572
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 6
- Left = 3840
- MaxLength = 20
- TabIndex = 32
- Top = 1200
- Width = 1572
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 5
- Left = 3840
- MaxLength = 20
- TabIndex = 31
- Top = 840
- Width = 1572
- End
- Begin VB.TextBox txtItem
- Height = 276
- Index = 4
- Left = 3840
- MaxLength = 20
- TabIndex = 27
- Top = 480
- Width = 1572
- End
- Begin VB.TextBox txtItem
- Height = 276
- Index = 3
- Left = 1200
- MaxLength = 20
- TabIndex = 24
- Top = 1920
- Width = 3852
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 2
- Left = 1200
- MaxLength = 20
- TabIndex = 9
- Top = 1560
- Width = 3852
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 1
- Left = 1200
- MaxLength = 8
- TabIndex = 8
- Top = 840
- Width = 1572
- End
- Begin VB.TextBox txtItem
- Height = 270
- Index = 0
- Left = 1200
- MaxLength = 5
- TabIndex = 7
- Top = 480
- Width = 1572
- End
- Begin VB.Label Label2
- Caption = "办 证 日 期:"
- Height = 252
- Index = 14
- Left = 2880
- TabIndex = 30
- Top = 1200
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "电子邮件地址:"
- Height = 252
- Index = 13
- Left = 2880
- TabIndex = 29
- Top = 840
- Width = 1092
- End
- Begin VB.Label Label2
- Caption = "电 话 号 码:"
- Height = 252
- Index = 4
- Left = 2880
- TabIndex = 28
- Top = 480
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "家庭住址:"
- Height = 252
- Index = 7
- Left = 240
- TabIndex = 26
- Top = 1920
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "读者性别:"
- Height = 252
- Index = 1
- Left = 240
- TabIndex = 25
- Top = 1200
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "工作单位:"
- Height = 252
- Index = 3
- Left = 240
- TabIndex = 5
- Top = 1560
- Width = 972
- End
- Begin VB.Label Label2
- Caption = "读者编号:"
- Height = 255
- Index = 0
- Left = 240
- TabIndex = 4
- Top = 480
- Width = 975
- End
- Begin VB.Label Label2
- Caption = "读者姓名:"
- Height = 252
- Index = 16
- Left = 240
- TabIndex = 3
- Top = 840
- Width = 972
- End
- End
- Begin VB.CommandButton cmdExit
- Caption = "返回 (&X)"
- Height = 375
- Left = 4320
- TabIndex = 1
- Top = 4200
- Width = 1215
- End
- Begin VB.CommandButton cmdSave
- Caption = "保存 (&S)"
- Height = 375
- Left = 2160
- TabIndex = 0
- Top = 4200
- Width = 1215
- End
- End
- Attribute VB_Name = "frmReader1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- '是否改动过记录,ture为改过
- Dim mblChange As Boolean
- Dim mrc As ADODB.Recordset
- Public txtSQL As String
- Private Sub cboItem_Change(Index As Integer)
- '有变化设置gblchange
- mblChange = True
- End Sub
- Private Sub cboItem_Click(Index As Integer)
- Dim sSql As String
- Dim MsgText As String
- Dim mrccc As ADODB.Recordset
- Dim intCount As Integer
- '初始化员工名称和ID
- If Index = 1 Then
- txtSQL = "select * from readertype where typename = '" & Trim(cboItem(1)) & "'"
- Set mrccc = ExecuteSQL(txtSQL, MsgText)
- If Not mrccc.EOF Then
- cboItem(0).Clear
- cboItem(0).AddItem Trim(mrccc.Fields(0))
- cboItem(0).ListIndex = 0
- For intCount = 2 To 4
- cboItem(intCount).Clear
- cboItem(intCount).AddItem Trim(mrccc.Fields(intCount))
- cboItem(intCount).ListIndex = 0
- Next intCount
- End If
- mrccc.Close
- End If
- End Sub
- Private Sub cboItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
- EnterToTab KeyCode
- End Sub
- Private Sub cmdExit_Click()
- If mblChange And cmdSave.Enabled Then
- If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
- '保存
- Call cmdSave_Click
- End If
- End If
- Unload Me
- End Sub
- Private Sub cmdSave_Click()
- Dim intCount As Integer
- Dim sMeg As String
- Dim mrcc As ADODB.Recordset
- Dim MsgText As String
- For intCount = 0 To 6
- If Trim(txtItem(intCount) & " ") = "" Then
- Select Case intCount
- Case 0
- sMeg = "读者编号"
- Case 1
- sMeg = "读者姓名"
- Case 2
- sMeg = "工作单位"
- Case 3
- sMeg = "家庭住址"
- Case 4
- sMeg = "电话号码"
- Case 5
- sMeg = "电子邮件地址"
- Case 6
- sMeg = "办证日期"
- End Select
- sMeg = sMeg & "不能为空!"
- MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
- txtItem(intCount).SetFocus
- Exit Sub
- End If
- Next intCount
- If Not IsDate(Trim(txtItem(6))) Then
- MsgBox "请输入日期!", vbOKOnly + vbExclamation, "警告"
- Exit Sub
- Else
- txtItem(6) = Format(txtItem(6), "yyyy-mm-dd")
- End If
- If gintRmode = 1 Then
- txtSQL = "select * from readers where readerno='" & Trim(txtItem(0)) & "'"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If mrc.EOF = False Then
- MsgBox "已经存在此读者编号的记录!", vbOKOnly + vbExclamation, "警告"
- txtItem(0).SetFocus
- Exit Sub
- End If
- mrc.Close
- End If
- If gintRmode = 2 Then
- '先删除已有记录
- txtSQL = "delete from readers where readerno='" & Trim(txtItem(0)) & "'"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- End If
- '再加入新记录
- txtSQL = "select * from readers"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- mrc.AddNew
- For intCount = 0 To 1
- mrc.Fields(intCount) = Trim(txtItem(intCount))
- Next intCount
- mrc.Fields(2) = Trim(cboItem(5))
- mrc.Fields(3) = Trim(cboItem(1))
- For intCount = 2 To 7
- mrc.Fields(intCount + 2) = Trim(txtItem(intCount))
- Next intCount
- mrc.Update
- mrc.Close
- If gintRmode = 1 Then
- For intCount = 0 To 7
- txtItem(intCount) = ""
- Next intCount
- mblChange = False
- If flagRedit Then
- Unload frmReader
- frmReader.txtSQL = "select * from readers"
- frmReader.Show
- End If
- ElseIf gintRmode = 2 Then
- Unload Me
- If flagRedit Then
- Unload frmReader
- End If
- frmReader.txtSQL = "select * from readers"
- frmReader.Show
- End If
- End Sub
- Private Sub Form_Load()
- Dim sSql As String
- Dim intCount As Integer
- Dim MsgText As String
- Dim mrcc As ADODB.Recordset
- If gintRmode = 1 Then
- Me.Caption = Me.Caption & "添加"
- '初始化物资名称
- txtSQL = "select DISTINCT typename from readertype"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- Do While Not mrc.EOF
- cboItem(1).AddItem Trim(mrc.Fields(0))
- mrc.MoveNext
- Loop
- cboItem(1).ListIndex = 0
- Else
- MsgBox "请先进行读者种类设置!", vbOKOnly + vbExclamation, "警告"
- cmdSave.Enabled = False
- Exit Sub
- End If
- mrc.Close
- cboItem(5).AddItem "男"
- cboItem(5).AddItem "女"
- ElseIf gintRmode = 2 Then
- Set mrcc = ExecuteSQL(txtSQL, MsgText)
- If mrcc.EOF = False Then
- With mrcc
- For intCount = 0 To 1
- If Not IsNull(.Fields(intCount)) Then
- txtItem(intCount) = .Fields(intCount)
- End If
- Next intCount
- cboItem(1).Clear
- cboItem(1).AddItem .Fields(3)
- cboItem(1).ListIndex = 0
- cboItem(5).Clear
- cboItem(5).AddItem .Fields(2)
- cboItem(5).ListIndex = 0
- For intCount = 2 To 7
- If Not IsNull(.Fields(intCount)) Then
- txtItem(intCount) = .Fields(intCount + 2)
- End If
- Next intCount
- txtSQL = "select * from readertype where typename = '" & Trim(cboItem(0)) & "'"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- cboItem(0).Clear
- cboItem(0).AddItem Trim(mrc.Fields(0))
- cboItem(0).ListIndex = 0
- For intCount = 2 To 4
- cboItem(intCount).Clear
- cboItem(intCount).AddItem Trim(mrc.Fields(intCount))
- cboItem(intCount).ListIndex = 0
- Next intCount
- End If
- mrc.Close
- txtSQL = "select DISTINCT typename from readertype"
- Set mrc = ExecuteSQL(txtSQL, MsgText)
- If Not mrc.EOF Then
- Do While Not mrc.EOF
- cboItem(1).AddItem Trim(mrc.Fields(0))
- mrc.MoveNext
- Loop
- Else
- MsgBox "请先进行读者种类设置!", vbOKOnly + vbExclamation, "警告"
- cmdSave.Enabled = False
- Exit Sub
- End If
- mrc.Close
- cboItem(5).Clear
- cboItem(5).AddItem "男"
- cboItem(5).AddItem "女"
- End With
- End If
- mrcc.Close
- Me.Caption = Me.Caption & "修改"
- End If
- mblChange = False
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- gintRmode = 0
- End Sub
- Private Sub txtItem_Change(Index As Integer)
- '有变化设置gblchange
- mblChange = True
- End Sub
- Private Sub txtItem_GotFocus(Index As Integer)
- txtItem(Index).SelStart = 0
- txtItem(Index).SelLength = Len(txtItem(Index))
- End Sub
- Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
- EnterToTab KeyCode
- End Sub