1,3)="建柜日期"
xlsheet.Cells(1,4)="备注"
Fori=0ToadoPrimaryRS.RecordCount-1
Forj=0ToadoPrimaryRS.Fields.Count-1
DataGrid1.Row=i
DataGrid1.Col=j
xlsheet.Cells(i+2,j+1)=DataGrid1.Text
Nextj
Nexti
Setxlapp=Nothing
Setxlbook=Nothing
EndSub
PrivateSubCommand13_Click()
Frame4.Visible=False
Frame1.Visible=True
Command9.Enabled=True
EndSub
PrivateSubCommand2_Click()
adoPrimaryRS.MoveNext
IfadoPrimaryRS.EOFThen
MsgBox("已经是第后一条记录了!")
adoPrimaryRS.MoveLast
Else
Text1.Text=adoPrimaryRS.Fields("档案柜号")
Text2.Text=adoPrimaryRS.Fields("备注")
EndIf
EndSub
PrivateSubCommand3_Click()
adoPrimaryRS.MovePrevious
IfadoPrimaryRS.BOFThen
MsgBox("已经是第一条记录了!")
adoPrimaryRS.MoveFirst
Else
Text1.Text=adoPrimaryRS.Fields("档案柜号")
Text2.Text=adoPrimaryRS.Fields("备注")
EndIf
EndSub
PrivateSubCommand4_Click()
adoPrimaryRS.MoveLast
Text1.Text=adoPrimaryRS.Fields("档案柜号")
Text2.Text=adoPrimaryRS.Fields("备注")
EndSub
PrivateSubCommand5_Click()
IfCommand5.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
EndIf
EndSub
PrivateSubCommand6_Click()
IfCommand6.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
EndIf
EndSub
PrivateSubCommand8_Click()
EndSub
PrivateSubCommand9_Click()
Frame4.Visible=True
Frame1.Visible=False
Command9.Enabled=False
EndSub
PrivateSubDataGrid1_Click()
Text1.Text=adoPrimaryRS.Fields("档案柜号")
Text2.Text=adoPrimaryRS.Fields("备注")
EndSub
PrivateSubForm_Load()
Left=(Screen.Width-Width)\2
Top=(Screen.Height-Height)\2
DimdbAsConnection
Setdb=NewConnection
db.CursorLocation=adUseClient
db.Open"PROVIDER=Microsoft.Jet.OLEDB.3.51;DataSource=dagl.mdb;"
SetadoPrimaryRS=NewRecordset
adoPrimaryRS.Open"select档案柜号,建柜人员,建柜日期,备注fromdagOrderby档案柜号",db,adOpenStatic,adLockOptimistic
Text1.Text=adoPrimaryRS.Fields("档案柜号")
Text2.Text=adoPrimaryRS.Fields("备注")
SetDataGrid1.DataSource=adoPrimaryRS
EndSub
组卷窗体的源代码:
DimWithEventsadoPrimaryRSAsRecordset
PrivateSubCombo1_Click()
Text7.Text=""
Text7.SetFocus
EndSub
PrivateSubCommand1_Click()
IfCommand1.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
adoPrimaryRS.Update
Command4.Enabled=False
Text6.Enabled=False
EndIf
EndSub
PrivateSubCommand10_Click()
Frame4.Visible=True
Frame1.Visible=False
Command10.Enabled=False
EndSub
PrivateSubCommand11_Click()
UnloadMe
EndSub
PrivateSubCommand12_Click()
DimdbAsConnection
Setdb=NewConnection
db.CursorLocation=adUseClient
db.Open"PROVIDER=Microsoft.Jet.OLEDB.3.51;DataSource=dagl.mdb;"
SetadoPrimaryRS=NewRecordset
a=Combo1.Text
b=Text7.Text
adoPrimaryRS.Open"select卷号,卷名,文件号,文件名,作者,入库日期,内容摘要,档案柜号,入卷日期,组卷人,状态fromfilewhere"&a&"like'%"&b&"%'",db,adOpenStatic,adLockOptimistic
SetDataGrid1.DataSource=adoPrimaryRS
EndSub
PrivateSubCommand13_Click()
Frame4.Visible=False
Frame1.Visible=True
Command10.Enabled=True
EndSub
PrivateSubCommand14_Click()
DimiAsInteger,jAsInteger
DimxlappAsExcel.Application
DimxlbookAsExcel.Workbook
DimxlsheetAsExcel.Worksheet
Setxlapp=CreateObject("excel.application")
xlapp.Visible=True
Setxlbook=xlapp.Workbooks.Add
Setxlsheet=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)="是否入卷"
Fori=0ToadoPrimaryRS.RecordCount-1
Forj=0ToadoPrimaryRS.Fields.Count-1
DataGrid1.Row=i
DataGrid1.Col=j
xlsheet.Cells(i+2,j+1)=DataGrid1.Text
Nextj
Nexti
Setxlapp=Nothing
Setxlbook=Nothing
EndSub
PrivateSubCommand2_Click()
Form6.Show
EndSub
PrivateSubCommand3_Click()
Form7.Show
EndSub
PrivateSubCommand4_Click()
DimdbAsConnection
Setdb=NewConnection
db.CursorLocation=adUseClient
db.Open"PROVIDER=Microsoft.Jet.OLEDB.3.51;DataSource=dagl.mdb;"
SetadoPrimaryRS=NewRecordset
adoPrimaryRS.Open"select*fromfilewhere文件号like'%"&Text3.Text&"%'",db,adOpenStatic,adLockOptimistic
Text6.Enabled=True
Text6.SetFocus
IfText1.Text=""Then
MsgBox("请先选择卷节点")
ExitSub
EndIf
IfText3.Text=""Then
MsgBox("请先选择文件号")
ExitSub
EndIf
IfText5.Text=""Then
MsgBox("请先选择档案柜号")
ExitSub
EndIf
IfText6.Text=""Then
MsgBox("请填写组卷人")
ExitSub
EndIf
adoPrimaryRS.Fields("卷号")=Text1.Text
adoPrimaryRS.Fields("卷名")=Text2.Text
adoPrimaryRS.Fields("组卷人")=Text6.Text
adoPrimaryRS.Fields("档案柜号")=Text5.Text
adoPrimaryRS.Fields("入卷日期")=Date
adoPrimaryRS.Fields("状态")="是"
adoPrimaryRS.Update
MsgBox("添加成功")
Setdb=NewConnection
db.CursorLocation=adUseClient
db.Open"PROVIDER=Microsoft.Jet.OLEDB.3.51;DataSource=dagl.mdb;"
SetadoPrimaryRS=NewRecordset
adoPrimaryRS.Open"select卷号,卷名,文件号,文件名,作者,入库日期,内容摘要,档案柜号,入卷日期,组卷人,状态fromfilewhere卷号like'%"&Text4.Text&"%'",db,adOpenStatic,adLockOptimistic
SetDataGrid1.DataSource=adoPrimar
上一篇:
VB文档管理信息系统(论文和程序)
下一篇:
我突然不喜欢你了