VB文档管理系统设计及源代码 第13页
Next i
Set xlapp = Nothing
Set xlbook = Nothing
End Sub
Private Sub Command2_Click()
adoPrimaryRS.MoveNext
If adoPrimaryRS.EOF Then
MsgBox ("已经是第后一条记录了!")
adoPrimaryRS.MoveLast
Else
Text1.Text = adoPrimaryRS.Fields("文件号")
Text2.Text = adoPrimaryRS.Fields("文件名")
Text3.Text = adoPrimaryRS.Fields("作者")
Text4.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("文件名")
Text3.Text = adoPrimaryRS.Fields("作者")
Text4.Text = adoPrimaryRS.Fields("内容摘要")
End If
End Sub
Private Sub Command4_Click()
adoPrimaryRS.MoveLast
Text1.Text = adoPrimaryRS.Fields("文件号")
Text2.Text = adoPrimaryRS.Fields("文件名")
Text3.Text = adoPrimaryRS.Fields("作者")
Text4.Text = adoPrimaryRS.Fields("内容摘要")
End Sub
Private Sub Command5_Click()
If Command5.Caption = "添加" Then
Command5.SetFocus
Command5.Caption = "保存"
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text1.SetFocus
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
adoPrimaryRS.AddNew
Else
adoPrimaryRS.Fields("文件号") = Text1.Text
adoPrimaryRS.Fields("文件名") = Text2.Text
adoPrimaryRS.Fields("作者") = Text3.Text
adoPrimaryRS.Fields("内容摘要") = Text4.Text
adoPrimaryRS.Fields("入库日期") = Date
adoPrimaryRS.Fields("状态") = "否"
adoPrimaryRS.Update
Command5.Caption = "添加"
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End If
End Sub
Private Sub Command6_Click()
If Command6.Caption = "编辑" Then
Command6.Caption = "更新"
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Else
adoPrimaryRS.Fields("文件号") = Text1.Text
adoPrimaryRS.Fields("文件名") = Text2.Text
adoPrimaryRS.Fields("作者") = Text3.Text
adoPrimaryRS.Fields("内容摘要") = Text4.Text
adoPrimaryRS.Update
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
End If
End Sub
Private Sub Command7_Click()
adoPrimaryRS.Delete
End Sub
Private Sub Command8_Click()
End Sub
Private Sub Command9_Click()
Frame4.Visible = True
Frame2.Visible = False
Command9.Enabled = False
End Sub
Private Sub DataGrid1_Click()
Text1.Text = adoPrimaryRS.Fields("文件号")
Text2.Text = adoPrimaryRS.Fields("文件名")
Text3.Text = adoPrimaryRS.Fields("作者")
Text4.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 file ", db, adOpenStatic, adLockOptimistic
If adoPrimaryRS.EOF Then
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Else
Text1.Text = adoPrimaryRS.Fields("文件号")
Text2.Text = adoPrimaryRS.Fields("文件名")
Text3.Text = adoPrimaryRS.Fields("作者")
Text4.Text = adoPrimaryRS.Fields("内容摘要")
End If
Set DataGrid1.DataSource = adoPrimaryRS
End Sub
创建卷名窗体的源代码:
Dim WithEvents adoPrimaryRS As Recordset
Dim a(100) As String
Dim db As Connection
Private Sub Command1_Click()
If Command1.Caption = "创建节点" Then
Append = MsgBox("节点序号确实无误吗", vbOKCancel, "核对节点序号")
If Append = vbOK Then
Command1.Caption = "保存节点"
Text1.Enabled = True
Text1.SetFocus
Text2.Enabled = True
Text3.Enabled = True
Command1.Enabled = True
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
End If
Else
Command1.Caption = "创建节点"
adoPrimaryRS.AddNew
adoPrimaryRS.Fields("卷号") = Text1.Text
adoPrimaryRS.Fields("卷名") = Text2.Text
adoPrimaryRS.Fields("备注") = Text3.Text
adoPrimaryRS.Fields("创卷人员") = "管理员"
adoPrimaryRS.Fields("创卷日期") = Date
adoPrimaryRS.Update
Text1.Enabled = False
Text2.Enabled = False
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] 下一页