VB文档管理系统设计及源代码 第16页

VB文档管理系统设计及源代码 第16页
End Sub
Private Sub Command1_Click()
adoPrimaryRS.MoveFirst
Text1.Text = adoPrimaryRS.Fields("档案柜号")
Text2.Text = adoPrimaryRS.Fields("备注")
End Sub
Private Sub Command10_Click()
Unload Me
End Sub
Private Sub Command11_Click()
Dim db As Connection
  Set db = New Connection
  db.CursorLocation = adUseClient
  db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=dagl.mdb;"
  Set adoPrimaryRS = New Recordset
  a = Combo1.Text
  b = Text3.Text
  adoPrimaryRS.Open "select  档案柜号,建柜人员,建柜日期,备注 from dag  where " & a & " like '%" & b & "%'", db, adOpenStatic, adLockOptimistic
  Set DataGrid1.DataSource = adoPrimaryRS
End Sub
Private Sub Command12_Click()
    Dim i As Integer, j As Integer
      Dim xlapp As Excel.Application
      Dim xlbook As Excel.Workbook
      Dim xlsheet As Excel.Worksheet
     Set xlapp = CreateObject("excel.application")
         xlapp.Visible = True
     Set xlbook = xlapp.Workbooks.Add
     Set xlsheet = xlbook.Worksheets(1)
       xlsheet.Cells(1, 1) = "档案柜号"
     xlsheet.Cells(1, 2) = "建柜人员"
     xlsheet.Cells(1, 3) = "建柜日期"
     xlsheet.Cells(1, 4) = "备注"
        For i = 0 To adoPrimaryRS.RecordCount - 1
        For j = 0 To adoPrimaryRS.Fields.Count - 1
              DataGrid1.Row = i
          DataGrid1.Col = j
          xlsheet.Cells(i + 2, j + 1) = DataGrid1.Text
        Next j
     Next i
    Set xlapp = Nothing
    Set xlbook = Nothing
End Sub
Private Sub Command13_Click()
Frame4.Visible = False
Frame1.Visible = True
Command9.Enabled = True
End Sub
Private Sub Command2_Click()
adoPrimaryRS.MoveNext
If adoPrimaryRS.EOF Then
MsgBox ("已经是第后一条记录了!")
adoPrimaryRS.MoveLast
Else
Text1.Text = adoPrimaryRS.Fields("档案柜号")
Text2.Text = adoPrimaryRS.Fields("备注")
End If
End Sub
Private Sub Command3_Click()
adoPrimaryRS.MovePrevious
If adoPrimaryRS.BOF Then
MsgBox ("已经是第一条记录了!")
adoPrimaryRS.MoveFirst
Else
Text1.Text = adoPrimaryRS.Fields("档案柜号")
Text2.Text = adoPrimaryRS.Fields("备注")
End If
End Sub
Private Sub Command4_Click()
adoPrimaryRS.MoveLast
Text1.Text = adoPrimaryRS.Fields("档案柜号")
Text2.Text = adoPrimaryRS.Fields("备注")
End Sub
Private Sub Command5_Click()
If Command5.Caption = "添加" Then
Command5.SetFocus
Command5.Caption = "保存"
Text1.Enabled = True
Text2.Enabled = True
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
adoPrimaryRS.AddNew
Else
adoPrimaryRS.Fields("档案柜号") = Text1.Text
adoPrimaryRS.Fields("备注") = Text2.Text
adoPrimaryRS.Fields("建柜人员") = "管理员"
adoPrimaryRS.Fields("建柜日期") = Date
adoPrimaryRS.Update
Command5.Caption = "添加"
Text1.Enabled = False
Text2.Enabled = False
End If
End Sub
Private Sub Command6_Click()
If Command6.Caption = "编辑" Then
Command6.Caption = "更新"
Command6.SetFocus
Text1.Enabled = True
Text2.Enabled = True
Else
adoPrimaryRS.Fields("档案柜号") = Text1.Text
adoPrimaryRS.Fields("备注") = Text2.Text
adoPrimaryRS.Update
Command6.Caption = "编辑"
Text1.Enabled = False
Text2.Enabled = False
End If
End Sub
Private Sub Command8_Click()
End Sub
Private Sub Command9_Click()
Frame4.Visible = True
Frame1.Visible = False
Command9.Enabled = False
End Sub
Private Sub DataGrid1_Click()
Text1.Text = adoPrimaryRS.Fields("档案柜号")
Text2.Text = adoPrimaryRS.Fields("备注")
End Sub
Private Sub Form_Load()
Left = (Screen.Width - Width) \ 2
Top = (Screen.Height - Height) \ 2
Dim db As Connection
  Set db = New Connection
  db.CursorLocation = adUseClient
  db.Open "PROVIDER=Microsoft.Jet.OLEDB.3.51;Data Source=dagl.mdb;"
  Set adoPrimaryRS = New Recordset
  adoPrimaryRS.Open "select  档案柜号,建柜人员,建柜日期,备注 from dag Order by 档案柜号 ", db, adOpenStatic, adLockOptimistic
  Text1.Text = adoPrimaryRS.Fields("档案柜号")
  Text2.Text = adoPrimaryRS.Fields("备注")
  Set DataGrid1.DataSource = adoPrimaryRS
End Sub
组卷窗体的源代码:
Dim WithEvents adoPrimaryRS As Recordset
Private Sub Combo1_Click()
Text7.Text = ""
Text7.SetFocus
End Sub
Private Sub Command1_Click()
If Command1.Caption = "编辑" Then
Command1.Caption = "更新"
Text6.Enabled = True
Else
Text6.Enabled = True
adoPrimaryRS.Fields("卷号") = Text1.Text
adoPrimaryRS.Fields("卷名") = Text2.Text
adoPrimaryRS.Fields("组卷人") = Text6.Text
adoPrimaryRS.Fields("文件号") = Text3.Text
adoPrimaryRS.Fields("档案柜号") = Text5.Text

 << 上一页  [11] [12] [13] [14] [15] [16] [17] [18] 下一页

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