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

VB文档管理系统设计及源代码 第17页
adoPrimaryRS.Update
Command4.Enabled = False
Text6.Enabled = False
End If
End Sub
Private Sub Command10_Click()
Frame4.Visible = True
Frame1.Visible = False
Command10.Enabled = False
End Sub
Private Sub Command11_Click()
Unload Me
End Sub
Private Sub Command12_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 = Text7.Text
  adoPrimaryRS.Open "select 卷号,卷名,文件号,文件名,作者,入库日期,内容摘要,档案柜号,入卷日期,组卷人,状态 from file  where " & a & " like '%" & b & "%'", db, adOpenStatic, adLockOptimistic
  Set DataGrid1.DataSource = adoPrimaryRS
End Sub
Private Sub Command13_Click()
Frame4.Visible = False
Frame1.Visible = True
Command10.Enabled = True
End Sub
Private Sub Command14_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) = "文件名"
     xlsheet.Cells(1, 5) = "作者"
     xlsheet.Cells(1, 6) = "入库日期"
     xlsheet.Cells(1, 7) = "内容摘要"
     xlsheet.Cells(1, 8) = "档案柜号"
     xlsheet.Cells(1, 9) = "入卷日期"
     xlsheet.Cells(1, 10) = "组卷人"
     xlsheet.Cells(1, 11) = "是否入卷"
     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 Command2_Click()
Form6.Show
End Sub
Private Sub Command3_Click()
Form7.Show
End Sub
Private Sub Command4_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
  adoPrimaryRS.Open "select * from file where 文件号 like '%" & Text3.Text & "%'", db, adOpenStatic, adLockOptimistic
Text6.Enabled = True
Text6.SetFocus
If Text1.Text = "" Then
MsgBox ("请先选择卷节点")
Exit Sub
End If
If Text3.Text = "" Then
MsgBox ("请先选择文件号")
Exit Sub
End If
If Text5.Text = "" Then
MsgBox ("请先选择档案柜号")
Exit Sub
End If
If Text6.Text = "" Then
MsgBox ("请填写组卷人")
Exit Sub
End If
adoPrimaryRS.Fields("卷号") = Text1.Text
adoPrimaryRS.Fields("卷名") = Text2.Text
adoPrimaryRS.Fields("组卷人") = Text6.Text
adoPrimaryRS.Fields("档案柜号") = Text5.Text
adoPrimaryRS.Fields("入卷日期") = Date
adoPrimaryRS.Fields("状态") = "是"
adoPrimaryRS.Update
MsgBox ("添加成功")
 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 file where 卷号 like '%" & Text4.Text & "%'", db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
Command4.Enabled = False
End Sub
Private Sub Command5_Click()
adoPrimaryRS.MoveFirst
Text1.Text = adoPrimaryRS.Fields("卷号")
Text2.Text = adoPrimaryRS.Fields("卷名")
Text6.Text = adoPrimaryRS.Fields("组卷人")
Text3.Text = adoPrimaryRS.Fields("文件号")
Text5.Text = adoPrimaryRS.Fields("档案柜号")
End Sub
Private Sub Command6_Click()
adoPrimaryRS.MoveNext
If adoPrimaryRS.EOF Then
MsgBox ("最后一条记录了!")
adoPrimaryRS.MoveLast
Else
Text1.Text = adoPrimaryRS.Fields("卷号")
Text2.Text = adoPrimaryRS.Fields("卷名")
Text6.Text = adoPrimaryRS.Fields("组卷人")
Text3.Text = adoPrimaryRS.Fields("文件号")
Text5.Text = adoPrimaryRS.Fields("档案柜号")
End If
End Sub
Private Sub Command7_Click()
adoPrimaryRS.MovePrevious
If adoPrimaryRS.BOF Then
MsgBox ("已经是第一条记录了!")
adoPrimaryRS.MoveFirst
Else
Text1.Text = adoPrimaryRS.Fields("卷号")
Text2.Text = adoPrimaryRS.Fields("卷名")
Text6.Text = adoPrimaryRS.Fields("组卷人")
Text3.Text = adoPrimaryRS.Fields("文件号")
Text5.Text = adoPrimaryRS.Fields("档案柜号")
End If
End Sub
Private Sub Command8_Click()
adoPrimaryRS.MoveLast
Text1.Text = adoPrimaryRS.Fields("卷号")
Text2.Text = adoPrimaryRS.Fields("卷名")
Text6.Text = adoPrimaryRS.Fields("组卷人")
Text3.Text = adoPrimaryRS.Fields("文件号")
Text5.Text = adoPrimaryRS.Fields("档案柜号")

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

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