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

📄 frm_stu.frm

📁 vb+sql2
💻 FRM
📖 第 1 页 / 共 4 页
字号:
      End
      Begin VB.Label Label13 
         Caption         =   "教材名"
         Height          =   495
         Left            =   -74280
         TabIndex        =   46
         Top             =   1920
         Width           =   975
      End
      Begin VB.Label Label18 
         Caption         =   "教材编号"
         Height          =   495
         Left            =   -74160
         TabIndex        =   45
         Top             =   960
         Width           =   1455
      End
      Begin VB.Label Label10 
         Caption         =   "领书班级"
         Height          =   615
         Left            =   -74040
         TabIndex        =   37
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label11 
         Caption         =   "日期"
         Height          =   495
         Left            =   -70680
         TabIndex        =   36
         Top             =   840
         Width           =   1215
      End
      Begin VB.Label Label12 
         Caption         =   "注意:两个条件至少要写一个"
         Height          =   495
         Left            =   -74760
         TabIndex        =   35
         Top             =   1440
         Width           =   2415
      End
      Begin VB.Label Label6 
         Caption         =   "领书时间"
         Height          =   495
         Left            =   -70560
         TabIndex        =   26
         Top             =   2520
         Width           =   1095
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "注意:两个条件至少要写一个"
         Height          =   195
         Left            =   -74280
         TabIndex        =   20
         Top             =   1560
         Width           =   2340
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "作者"
         Height          =   195
         Left            =   -70320
         TabIndex        =   18
         Top             =   840
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "教材名"
         Height          =   195
         Left            =   -74160
         TabIndex        =   16
         Top             =   840
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H80000016&
         BackStyle       =   0  'Transparent
         Caption         =   "注意:班级为学生领书,单位为教师领书"
         Height          =   195
         Left            =   -74520
         TabIndex        =   15
         Top             =   5160
         Width           =   3240
      End
      Begin VB.Label Label1 
         Caption         =   "班级名称"
         Height          =   375
         Left            =   -74040
         TabIndex        =   14
         Top             =   1560
         Width           =   1575
      End
      Begin VB.Label Label4 
         Caption         =   "教材编号"
         Height          =   495
         Left            =   -70560
         TabIndex        =   13
         Top             =   1560
         Width           =   975
      End
      Begin VB.Label Label7 
         Caption         =   "领书数量"
         Height          =   615
         Left            =   -74040
         TabIndex        =   12
         Top             =   3480
         Width           =   1215
      End
      Begin VB.Label Label9 
         Caption         =   "经办人"
         Height          =   615
         Left            =   -70560
         TabIndex        =   11
         Top             =   3480
         Width           =   1095
      End
      Begin VB.Label Label14 
         Caption         =   "Label14"
         Height          =   135
         Left            =   -69240
         TabIndex        =   10
         Top             =   2640
         Width           =   15
      End
      Begin VB.Label Label20 
         Caption         =   "领书人"
         Height          =   495
         Left            =   -74040
         TabIndex        =   9
         Top             =   2520
         Width           =   855
      End
   End
End
Attribute VB_Name = "frm_fetchbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim cn As Connection
Dim rs As Recordset
Dim rs2 As Recordset
Dim rs3 As Recordset
Dim rs4 As Recordset
Dim T1  As String
Dim T2  As String

Private Sub Command1_Click()
Set rs3 = New Recordset
  rs3.Open "select * from 班级表 where 班级名='" & Text3.Text & "'", cn, adOpenDynamic, adLockBatchOptimistic, adCmdText
If rs3.EOF = True Then
MsgBox "班级名称不存在,请重输!", vbOKOnly, "警告"
Text3.SetFocus
Exit Sub
End If

Set rs = New Recordset
  rs.Open "select * from 教材表 where id='" & Text4.Text & "'", cn, adOpenDynamic, adLockBatchOptimistic, adCmdText
If rs.EOF = True Then
MsgBox "教材编号不存在,请重输!", vbOKOnly, "警告"
Text4.SetFocus
Exit Sub
End If

If rs!教材数量 < Val(Text7.Text) Then
MsgBox "库库存数量不足!", vbOKOnly, "警告"
Text7.SetFocus
Exit Sub
End If

Set rs = New Recordset
Set rs2 = New Recordset
rs.Open "select * from 教材表 where id= '" & Text4.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
rs!教材数量 = rs!教材数量 - Val(Text7.Text)
rs.Update

rs2.Open "教材出库历史表", cn, adOpenDynamic, adLockOptimistic, adCmdTable
rs2.AddNew
rs2!班级或单位名称 = Text3.Text
rs2!领书人 = Text19.Text
rs2!教材编号 = Text4.Text
rs2!领书数量 = Text7.Text
rs2!日期 = Text5.Text
rs2!经办人 = Text9.Text
rs2.Update
MsgBox "领书成功!", vbOKOnly
End Sub

Private Sub Command11_Click()
Text17.Text = ""
Command8.Enabled = False
DataGrid1.ReBind
        rs2.Close
Command11.Enabled = False
End Sub

Private Sub Command13_Click()
T1 = Trim(Text6.Text)
T2 = Trim(Text8.Text)
Set rs3 = New Recordset
rs3.CursorLocation = adUseClient

If T2 = "" Then
If T1 = "" Then
MsgBox "您还没有输入信息!", vbOKOnly, "警告"
Text6.SetFocus
Else
rs3.Open "select * from 教材出库历史表 where 班级或单位名称= '" & Text6.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid3.DataSource = rs3
Command14.Enabled = True
End If
Else
rs3.Open "select * from 教材出库历史表 where 日期='" & Text8.Text & "' and 班级或单位名称= '" & Text6.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid3.DataSource = rs3
Command14.Enabled = True
End If
If T1 = "" Then
If T2 = "" Then
End If
Set rs3 = New Recordset
rs3.CursorLocation = adUseClient
rs3.Open "select * from 教材出库历史表 where 日期= '" & Text8.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid3.DataSource = rs3
Command14.Enabled = True
End If
End Sub

Private Sub Command14_Click()
Text6.Text = ""
Text8.Text = ""
DataGrid3.ReBind
        rs3.Close
Command14.Enabled = False
End Sub

Private Sub Command17_Click()
Set rs = New Recordset
  rs.Open "select * from 教材表 where 出版社='" & Text12.Text & "' and 作者='" & Text11.Text & "' and 教材名='" & Text10.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
If rs.EOF = True Then
Set rs2 = New Recordset
rs2.Open "教材表", cn, adOpenDynamic, adLockOptimistic, adCmdTable
rs2.AddNew
rs2!教材名 = Text10.Text
rs2!作者 = Text11.Text
rs2!出版社 = Text12.Text
rs2!出版年月 = Text13.Text
rs2!教材单价 = Text14.Text
rs2!教材数量 = Text15.Text
rs2.Update
Else
rs!教材数量 = rs!教材数量 + Val(Text15.Text)
rs.Update
End If
Set rs = New Recordset
  rs.Open "select * from 教材表 where 出版社='" & Text12.Text & "' and 作者='" & Text11.Text & "' and 教材名='" & Text10.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
Set rs2 = New Recordset
rs2.Open "教材入库历史表", cn, adOpenDynamic, adLockOptimistic, adCmdTable
rs2.AddNew
rs2!单位或个人 = Text20.Text
rs2!教材编号 = rs!id
rs2!入库数量 = Text15.Text
rs2!日期 = Text16.Text
rs2!经办人 = Text18.Text
rs2.Update
MsgBox "教材入库成功!", vbOKOnly
End Sub

Private Sub Command20_Click()
T1 = Trim(Text21.Text)
T2 = Trim(Text22.Text)
Set rs4 = New Recordset
rs4.CursorLocation = adUseClient

If T2 = "" Then
If T1 = "" Then
MsgBox "您还没有输入信息!", vbOKOnly, "警告"
Text21.SetFocus
Exit Sub
Else
rs4.Open "select * from 教材入库历史表 where 单位或个人= '" & Text21.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid4.DataSource = rs4
Command21.Enabled = True
End If
Else
rs4.Open "select * from 教材入库历史表 where 日期='" & Text22.Text & "' and 单位或个人= '" & Text21.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid4.DataSource = rs4
Command21.Enabled = True
End If
If T1 = "" Then
If T2 = "" Then
End If
Set rs4 = New Recordset
rs4.CursorLocation = adUseClient
rs4.Open "select * from 教材入库历史表 where 日期= '" & Text22.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid4.DataSource = rs4
Command21.Enabled = True
End If
End Sub

Private Sub Command21_Click()
Text21.Text = ""
Text22.Text = ""
DataGrid4.ReBind
        rs4.Close
Command21.Enabled = False
End Sub

Private Sub Command3_Click()
T1 = Trim(Text1.Text)
T2 = Trim(Text2.Text)
Set rs = New Recordset
rs.CursorLocation = adUseClient

If T2 = "" Then
If T1 = "" Then
MsgBox "您还没有输入信息!", vbOKOnly, "警告"
Text1.SetFocus
Else
rs.Open "select * from 教材表 where 教材名= '" & Text1.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid2.DataSource = rs
Command4.Enabled = True
End If
Else
rs.Open "select * from 教材表 where 作者='" & Text2.Text & "' and 教材名= '" & Text1.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid2.DataSource = rs
Command4.Enabled = True
End If
If T1 = "" Then
If T2 = "" Then
End If
Set rs = New Recordset
rs.CursorLocation = adUseClient
rs.Open "select * from 教材表 where 作者= '" & Text2.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
        Set DataGrid2.DataSource = rs
Command4.Enabled = True
End If
End Sub

Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
DataGrid2.ReBind
        rs.Close
Command4.Enabled = False
End Sub

Private Sub Command5_Click(Index As Integer)
Unload Me
frm_mainconsole.Show
End Sub

Private Sub Command6_Click()
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text7.Text = ""
Text9.Text = ""
Text19.Text = ""
End Sub

Private Sub Command7_Click()
str1 = Text17.Text
Set rs2 = New Recordset
rs2.CursorLocation = adUseClient
rs2.Open "select * from 教材表 where id= '" & Text17.Text & "'", cn, adOpenDynamic, adLockOptimistic, adCmdText
If rs2.EOF = True Then
MsgBox "教材编号不存在,请核对!", vbOKOnly, "警告"
Exit Sub
End If
        Set DataGrid1.DataSource = rs2
Command11.Enabled = True
Command8.Enabled = True
End Sub

Private Sub Command8_Click()
frm_checkedit.Show
End Sub

Private Sub Command9_Click()
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
Text13.Text = ""
Text14.Text = ""
Text15.Text = ""
Text16.Text = ""
Text18.Text = ""
Text20.Text = ""
End Sub

Private Sub Form_Load()
Set cn = New Connection
cn.ConnectionString = "FileDSN=通用教材管理系统.dsn;UID=sa;PWD="
cn.Open
End Sub


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

⌨️ 快捷键说明

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