VB图书管理系统 第6页

VB图书管理系统 第6页
MSFlexGrid1.Text = "编号
"

  
MSFlexGrid1.Col = 1

  MSFlexGrid1.Text = "购买日期
"

  
MSFlexGrid1.Col = 2

  MSFlexGrid1.Text = "书名
"

  
MSFlexGrid1.Col = 3

  MSFlexGrid1.Text = "类型
"

  
MSFlexGrid1.Col = 4

  MSFlexGrid1.Text = "定价
"

  
MSFlexGrid1.Col = 5

  MSFlexGrid1.Text = "备注
"

  
Exit Sub

  
setheaderror:

  
MsgBox Err.Description

  
End Sub

  
Private Sub Form_Unload(Cancel As Integer)

  
findok = False

  
rs_data1.Close

  
rs_custom.Close

  
End Sub

  
Private Sub MSFlexGrid1_Click()

  
On Error GoTo griderror

  
Dim getrow As Long

  
getrow = MSFlexGrid1.Row

  
If MSFlexGrid1.Rows = 1 Then

  MsgBox "无相关记录
", vbOKOnly + vbExclamation, ""

  
Else

  
select_row = MSFlexGrid1.TextMatrix(getrow, 0)

  
End If

  
griderror:

  
If Err.Number <> 0 Then

  
MsgBox Err.Description

  
End If

  
End Sub

  
Public Sub showdata()

  
With MSFlexGrid2

  
.Rows = rs_data2.RecordCount + 1

  
.Row = 0

  
If Not rs_data2.EOF Then

  
rs_data2.MoveFirst

  
Do While Not rs_data2.EOF

  
.Row = .Row + 1

  
.Col = 0

  
If Not IsNull(rs_data2.Fields(0)) Then .Text = rs_data2.Fields(0) Else .Text = ""

  
.Col = 1

  
If Not IsNull(rs_data2.Fields(1)) Then .Text = rs_data2.Fields(1) Else .Text = ""

  
.Col = 2

  
If Not IsNull(rs_data2.Fields(2)) Then .Text = rs_data2.Fields(2) Else .Text = ""

  
.Col = 3

  
If Not IsNull(rs_data2.Fields(3)) Then .Text = rs_data2.Fields(3) Else .Text = ""

  
.Col = 4

  
If Not IsNull(rs_data2.Fields(4)) And CDbl(rs_data2.Fields(4)) < 0 Then

  
.Text = -CDbl(rs_data2.Fields(4))

  
Else

  
.Text = rs_data2.Fields(4)

  
End If

  
.Col = 5

  
If Not IsNull(rs_data2.Fields(5)) Then .Text = rs_data2.Fields(5) Else .Text = ""

  
.Col = 6

  
If Not IsNull(rs_data2.Fields(6)) Then .Text = rs_data2.Fields(6) Else .Text = ""

  
.Col = 7

  
If Not IsNull(rs_data2.Fields(7)) And CDbl(rs_data2.Fields(4)) < 0 Then

  
.Text = -CDbl(rs_data2.Fields(7))

  
Else

  
.Text = rs_data2.Fields(7)

  
End If

  
.Col = 8

  
If Not IsNull(rs_data2.Fields(8)) Then .Text = rs_data2.Fields(8) Else .Text = ""

  
rs_data2.MoveNext

  
Loop

  
rs_data2.MoveLast

  
End If

  
End With

  
End Sub

  (5) 查询子窗体代码


  查询子窗体是用来查询库房中图书资料明细的。其运行效果如图41所示。

   若图片无法显示请联系站长QQ3249114

  图41 查询子窗体运行效果


  在列表框中给出编号或年月日后,查询按钮的Click事件将给出与数据库查找比较的结果。

  Private Sub Command1_Click()

  
On Error GoTo cmderror

  
Dim find_date1 As String

  
Dim find_date2 As String

  If Option1.Value = True Then

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有