VB+Access设计图书管理系统 下载本文

MSFlexGrid1.Col = 0

If Not IsNull(rs_data1.Fields(0)) Then MSFlexGrid1.Text = rs_data1.Fields(0) Else

MSFlexGrid1.Text = \

MSFlexGrid1.Col = 1

If Not IsNull(rs_data1.Fields(1)) Then MSFlexGrid1.Text = rs_data1.Fields(1) Else

MSFlexGrid1.Text = \MSFlexGrid1.Col = 2 If Not IsNull(rs_data1.Fields(2)) Then MSFlexGrid1.Text = rs_data1.Fields(2) Else MSFlexGrid1.Text = \MSFlexGrid1.Col = 3 If Not IsNull(rs_data1.Fields(3)) Then MSFlexGrid1.Text = rs_data1.Fields(3) Else MSFlexGrid1.Text = \MSFlexGrid1.Col = 4 If Not IsNull(rs_data1.Fields(4)) Then MSFlexGrid1.Text = rs_data1.Fields(4) Else MSFlexGrid1.Text = \MSFlexGrid1.Col = 5 If Not IsNull(rs_data1.Fields(5)) Then MSFlexGrid1.Text = rs_data1.Fields(5) Else MSFlexGrid1.Text = \rs_data1.MoveNext Loop End If displayerror: If Err.Number <> 0 Then

MsgBox Err.Description

End If

End Sub

Public Sub setgrid()

Dim i As Integer On Error GoTo seterror With MSFlexGrid1 .ScrollBars = flexScrollBarBoth .FixedCols = 0 .Rows = rs_data1.RecordCount + 1 .Cols = 6 .SelectionMode = flexSelectionByRow For i = 0 To .Rows - 1 .RowHeight(i) = 315 Next For i = 0 To .Cols - 1 .ColWidth(i) = 1300 Next i End With Exit Sub seterror: MsgBox Err.Description

End Sub

Public Sub setgridhead()

On Error GoTo setheaderror

MSFlexGrid1.Row = 0

MSFlexGrid1.Col = 0 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 \无相关记录\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