www.pudn.com > 图书管理系统包括VB,ASP各一份代码.rar > JiShuZiLiao.dob
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.UserDocument JiShuZiLiao
Appearance = 0 'Flat
BackColor = &H80000005&
ClientHeight = 5700
ClientLeft = 0
ClientTop = 0
ClientWidth = 8250
HScrollSmallChange= 225
ScaleHeight = 5700
ScaleWidth = 8250
VScrollSmallChange= 225
Begin TabDlg.SSTab SSTab1
Height = 5175
Left = 360
TabIndex = 16
Top = 360
Width = 7215
_ExtentX = 12726
_ExtentY = 9128
_Version = 393216
TabsPerRow = 6
TabHeight = 520
BackColor = -2147483643
TabCaption(0) = "登记"
TabPicture(0) = "JiShuZiLiao.dox":0000
Tab(0).ControlEnabled= -1 'True
Tab(0).Control(0)= "lblLabels(0)"
Tab(0).Control(0).Enabled= 0 'False
Tab(0).Control(1)= "lblLabels(1)"
Tab(0).Control(1).Enabled= 0 'False
Tab(0).Control(2)= "lblLabels(2)"
Tab(0).Control(2).Enabled= 0 'False
Tab(0).Control(3)= "lblLabels(3)"
Tab(0).Control(3).Enabled= 0 'False
Tab(0).Control(4)= "lblLabels(4)"
Tab(0).Control(4).Enabled= 0 'False
Tab(0).Control(5)= "lblLabels(5)"
Tab(0).Control(5).Enabled= 0 'False
Tab(0).Control(6)= "lblLabels(6)"
Tab(0).Control(6).Enabled= 0 'False
Tab(0).Control(7)= "lblLabels(7)"
Tab(0).Control(7).Enabled= 0 'False
Tab(0).Control(8)= "lblLabels(8)"
Tab(0).Control(8).Enabled= 0 'False
Tab(0).Control(9)= "lblLabels(9)"
Tab(0).Control(9).Enabled= 0 'False
Tab(0).Control(10)= "lblLabels(10)"
Tab(0).Control(10).Enabled= 0 'False
Tab(0).Control(11)= "lblLabels(11)"
Tab(0).Control(11).Enabled= 0 'False
Tab(0).Control(12)= "lblLabels(12)"
Tab(0).Control(12).Enabled= 0 'False
Tab(0).Control(13)= "Label1"
Tab(0).Control(13).Enabled= 0 'False
Tab(0).Control(14)= "lblLabels(16)"
Tab(0).Control(14).Enabled= 0 'False
Tab(0).Control(15)= "lblLabels(15)"
Tab(0).Control(15).Enabled= 0 'False
Tab(0).Control(16)= "lbl记录数"
Tab(0).Control(16).Enabled= 0 'False
Tab(0).Control(17)= "DTPicker1(1)"
Tab(0).Control(17).Enabled= 0 'False
Tab(0).Control(18)= "DataCombo2"
Tab(0).Control(18).Enabled= 0 'False
Tab(0).Control(19)= "datPrimaryRS"
Tab(0).Control(19).Enabled= 0 'False
Tab(0).Control(20)= "txtFields(3)"
Tab(0).Control(20).Enabled= 0 'False
Tab(0).Control(21)= "txtFields(4)"
Tab(0).Control(21).Enabled= 0 'False
Tab(0).Control(22)= "txtFields(5)"
Tab(0).Control(22).Enabled= 0 'False
Tab(0).Control(23)= "txtFields(6)"
Tab(0).Control(23).Enabled= 0 'False
Tab(0).Control(24)= "txtFields(8)"
Tab(0).Control(24).Enabled= 0 'False
Tab(0).Control(25)= "txtFields(9)"
Tab(0).Control(25).Enabled= 0 'False
Tab(0).Control(26)= "txtFields(10)"
Tab(0).Control(26).Enabled= 0 'False
Tab(0).Control(27)= "txtFields(11)"
Tab(0).Control(27).Enabled= 0 'False
Tab(0).Control(28)= "txtFields(12)"
Tab(0).Control(28).Enabled= 0 'False
Tab(0).Control(29)= "picButtons"
Tab(0).Control(29).Enabled= 0 'False
Tab(0).Control(30)= "DTPicker1(0)"
Tab(0).Control(30).Enabled= 0 'False
Tab(0).ControlCount= 31
TabCaption(1) = "清单"
TabPicture(1) = "JiShuZiLiao.dox":001C
Tab(1).ControlEnabled= 0 'False
Tab(1).Control(0)= "DataGrid1"
Tab(1).Control(0).Enabled= 0 'False
Tab(1).Control(1)= "cmdPrint"
Tab(1).Control(1).Enabled= 0 'False
Tab(1).ControlCount= 2
TabCaption(2) = "查询"
TabPicture(2) = "JiShuZiLiao.dox":0038
Tab(2).ControlEnabled= 0 'False
Tab(2).Control(0)= "cmdFilter"
Tab(2).Control(0).Enabled= 0 'False
Tab(2).Control(1)= "cmdAll"
Tab(2).Control(1).Enabled= 0 'False
Tab(2).Control(2)= "cmdCancel"
Tab(2).Control(2).Enabled= 0 'False
Tab(2).Control(3)= "Frame1"
Tab(2).Control(3).Enabled= 0 'False
Tab(2).ControlCount= 4
Begin VB.CommandButton cmdPrint
Caption = "打印(&P)"
Height = 375
Left = -69600
TabIndex = 50
Top = 5280
Width = 1335
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1875
Left = -74760
TabIndex = 39
Top = 600
Width = 6735
Begin VB.TextBox txtFields
Height = 285
Index = 14
Left = 1380
TabIndex = 41
Top = 420
Width = 1815
End
Begin VB.TextBox txtFields
Height = 285
Index = 15
Left = 1380
TabIndex = 40
Top = 1290
Width = 4485
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 330
Index = 2
Left = 1380
TabIndex = 42
Top = 840
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
CheckBox = -1 'True
DateIsNull = -1 'True
Format = 23724033
CurrentDate = 37038
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 330
Index = 3
Left = 4080
TabIndex = 43
Top = 840
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
CheckBox = -1 'True
DateIsNull = -1 'True
Format = 23724033
CurrentDate = 37038
End
Begin MSDataListLib.DataCombo DataCombo3
Bindings = "JiShuZiLiao.dox":0054
Height = 330
Left = 4080
TabIndex = 44
Top = 420
Width = 1815
_ExtentX = 3201
_ExtentY = 582
_Version = 393216
ListField = "分类"
BoundColumn = "分类ID"
Text = ""
End
Begin VB.Label lblLabels
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "总号:"
Height = 180
Index = 18
Left = 840
TabIndex = 49
Top = 480
Width = 450
End
Begin VB.Label lblLabels
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "资料名称:"
Height = 180
Index = 17
Left = 480
TabIndex = 48
Top = 1350
Width = 810
End
Begin VB.Label lblLabels
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "编制日期由:"
Height = 180
Index = 19
Left = 300
TabIndex = 47
Top = 915
Width = 990
End
Begin VB.Label lblLabels
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "至:"
Height = 180
Index = 21
Left = 3720
TabIndex = 46
Top = 915
Width = 270
End
Begin VB.Label lblLabels
Alignment = 1 'Right Justify
AutoSize = -1 'True
Caption = "分类:"
Height = 180
Index = 13
Left = 3540
TabIndex = 45
Top = 480
Width = 450
End
End
Begin VB.CommandButton cmdCancel
Caption = "取消(&C)"
Height = 375
Left = -69660
TabIndex = 38
Top = 3480
Width = 1335
End
Begin VB.CommandButton cmdAll
Caption = "全部(&A)"
Height = 375
Left = -71220
TabIndex = 37
Top = 3480
Width = 1335
End
Begin VB.CommandButton cmdFilter
Caption = "筛选(&F)"
Height = 375
Left = -72660
TabIndex = 36
Top = 3480
Width = 1215
End
Begin MSComCtl2.DTPicker DTPicker1
DataField = "登记日期"
DataSource = "datPrimaryRS"
Height = 330
Index = 0
Left = 4800
TabIndex = 0
Top = 720
Width = 2175
_ExtentX = 3836
_ExtentY = 582
_Version = 393216
CheckBox = -1 'True
Format = 23724033
CurrentDate = 37049
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "JiShuZiLiao.dox":0069
Height = 4575
Left = -74880
TabIndex = 31
Top = 480
Width = 6975
_ExtentX = 12303
_ExtentY = 8070
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.PictureBox picButtons
Appearance = 0 'Flat
BorderStyle = 0 'None
ForeColor = &H80000008&
Height = 300
Left = 1920
ScaleHeight = 300
ScaleWidth = 4890
TabIndex = 30
Top = 4080
Width = 4890
Begin VB.CommandButton cmdRefresh
Caption = "刷新(&R)"
Height = 300
Left = 3521
TabIndex = 15
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdDelete
Caption = "删除(&D)"
Height = 300
Left = 2367
TabIndex = 14
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdUpdate
Caption = "更新(&U)"
Height = 300
Left = 1213
TabIndex = 13
Top = 0
Width = 1095
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Height = 300
Left = 59
TabIndex = 12
Top = 0
Width = 1095
End
End
Begin VB.TextBox txtFields
DataField = "备注"
DataSource = "datPrimaryRS"
Height = 285
Index = 12
Left = 4800
TabIndex = 11
Top = 3405
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "单价"
DataSource = "datPrimaryRS"
Height = 285
Index = 11
Left = 1200
TabIndex = 10
Top = 3405
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "页数"
DataSource = "datPrimaryRS"
Height = 285
Index = 10
Left = 4800
TabIndex = 9
Top = 2955
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "份数"
DataSource = "datPrimaryRS"
Height = 285
Index = 9
Left = 1200
TabIndex = 8
Top = 2955
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "来源"
DataSource = "datPrimaryRS"
Height = 285
Index = 8
Left = 4800
TabIndex = 7
Top = 2508
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "编制单位"
DataSource = "datPrimaryRS"
Height = 285
Index = 6
Left = 4800
TabIndex = 4
Top = 1614
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "资料名称"
DataSource = "datPrimaryRS"
Height = 285
Index = 5
Left = 1200
TabIndex = 5
Top = 2061
Width = 5775
End
Begin VB.TextBox txtFields
DataField = "密别"
DataSource = "datPrimaryRS"
Height = 285
Index = 4
Left = 1200
TabIndex = 3
Top = 1614
Width = 2175
End
Begin VB.TextBox txtFields
DataField = "文别"
DataSource = "datPrimaryRS"
Height = 285
Index = 3
Left = 4800
TabIndex = 2
Top = 1167
Width = 2175
End
Begin MSAdodcLib.Adodc datPrimaryRS
Height = 330
Left = 2520
Top = 4485
Width = 2010
_ExtentX = 3545
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = " "
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataListLib.DataCombo DataCombo2
Bindings = "JiShuZiLiao.dox":007E
DataField = "分类id"
DataSource = "datPrimaryRS"
Height = 330
Left = 1200
TabIndex = 1
Top = 1167
Width = 2175
_ExtentX = 3836
_ExtentY = 582
_Version = 393216
ListField = "分类"
BoundColumn = "分类ID"
Text = ""
End
Begin MSComCtl2.DTPicker DTPicker1
DataField = "编制日期"
DataSource = "datPrimaryRS"
Height = 330
Index = 1
Left = 1200
TabIndex = 6
Top = 2508
Width = 2175
_ExtentX = 3836
_ExtentY = 582
_Version = 393216
CheckBox = -1 'True
Format = 23724033
CurrentDate = 37049
End
Begin VB.Label lbl记录数
Caption = "0"
Height = 255
Left = 6120
TabIndex = 35
Top = 4560
Width = 615
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "共有记录数:"
Height = 180
Index = 15
Left = 5040
TabIndex = 34
Top = 4560
Width = 990
End
Begin VB.Label lblLabels
AutoSize = -1 'True
BackColor = &H80000005&
BackStyle = 0 'Transparent
Caption = "记录:"
Height = 180
Index = 16
Left = 1920
TabIndex = 33
Top = 4560
Width = 450
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
BorderStyle = 1 'Fixed Single
Caption = "总号"
DataField = "总号"
DataSource = "datPrimaryRS"
BeginProperty Font
Name = "Times New Roman"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Height = 285
Left = 1200
TabIndex = 32
Top = 720
Width = 2175
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "备注:"
Height = 180
Index = 12
Left = 4200
TabIndex = 29
Top = 3405
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "单价:"
Height = 180
Index = 11
Left = 600
TabIndex = 28
Top = 3405
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "页数:"
Height = 180
Index = 10
Left = 4200
TabIndex = 27
Top = 2955
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "份数:"
Height = 180
Index = 9
Left = 600
TabIndex = 26
Top = 2955
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "来源:"
Height = 180
Index = 8
Left = 4200
TabIndex = 25
Top = 2508
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "编制日期:"
Height = 180
Index = 7
Left = 240
TabIndex = 24
Top = 2508
Width = 810
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "编制单位:"
Height = 180
Index = 6
Left = 3840
TabIndex = 23
Top = 1614
Width = 810
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "资料名称:"
Height = 180
Index = 5
Left = 240
TabIndex = 22
Top = 2061
Width = 810
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "密别:"
Height = 180
Index = 4
Left = 600
TabIndex = 21
Top = 1614
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "文别:"
Height = 180
Index = 3
Left = 4200
TabIndex = 20
Top = 1167
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "分类:"
Height = 180
Index = 2
Left = 600
TabIndex = 19
Top = 1167
Width = 450
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "登记日期:"
Height = 180
Index = 1
Left = 3840
TabIndex = 18
Top = 720
Width = 810
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "总号:"
Height = 180
Index = 0
Left = 600
TabIndex = 17
Top = 720
Width = 450
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 2280
Top = 0
Visible = 0 'False
Width = 1890
_ExtentX = 3334
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 4440
Top = 0
Visible = 0 'False
Width = 1890
_ExtentX = 3334
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "JiShuZiLiao"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Private Sub cmdAdd_Click()
On Error GoTo AddErr
datPrimaryRS.Recordset.AddNew
DTPicker1(0).Value = Format(Now(), "Short Date")
DTPicker1(1).Value = Format(Now(), "Short Date")
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
Private Sub cmdAll_Click()
datPrimaryRS.Recordset.Filter = ""
datPrimaryRS.Refresh
Adodc2.Recordset.Filter = ""
Adodc2.Refresh
SSTab1.Tab = 1
End Sub
Private Sub cmdCancel_Click()
SSTab1.Tab = 1
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
Dim nYN As Byte
nYN = MsgBox("您正准备删除当前记录。" & Chr(13) & Chr(13) & _
"假如您单击“是”,您将不能撤消这个删除操作。" & Chr(13) & _
"您确认删除这条记录吗?", vbExclamation + vbYesNo)
If nYN = vbYes Then
With datPrimaryRS.Recordset
If .EOF And .BOF Then Exit Sub
.Delete
.MoveNext
If .RecordCount > 0 And .EOF Then
.MoveLast
ElseIf .RecordCount = 0 Then .MovePrevious
End If
End With
End If
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub
Private Sub cmdFilter_Click()
Dim strFilter As String
Dim strFilter2 As String
'生成filter字符串
strFilter = ""
If Trim(txtFields(14).Text) <> "" Then
strFilter = "总号=" & Trim(txtFields(14).Text)
End If
If Not IsNull(DTPicker1(2).Value) Then
If strFilter = "" Then
strFilter = "编制日期 >= #" & Format(DTPicker1(2).Value, "yyyy-mm-dd") & "#"
Else
strFilter = strFilter & " and 编制日期 >= #" & Format(DTPicker1(2).Value, "yyyy-mm-dd") & "#"
End If
End If
If Not IsNull(DTPicker1(3).Value) Then
If strFilter = "" Then
strFilter = "编制日期 <= #" & Format(DTPicker1(3).Value, "yyyy-mm-dd") & "#"
Else
strFilter = strFilter & " and 编制日期 <= #" & Format(DTPicker1(3).Value, "yyyy-mm-dd") & "#"
End If
End If
If txtFields(15).Text <> "" Then
If strFilter = "" Then
strFilter = "资料名称 like '%" & txtFields(15).Text & "%'"
Else
strFilter = strFilter & " and 资料名称 like '%" & txtFields(15).Text & "%'"
End If
End If
If DataCombo3.Text <> "" Then
If strFilter = "" Then
strFilter = "分类ID=" & DataCombo3.BoundText
strFilter2 = "分类='" & DataCombo3.Text & "'"
Else
strFilter = strFilter & " and 分类ID=" & DataCombo3.BoundText
strFilter2 = strFilter & " and 分类='" & DataCombo3.Text & "'"
End If
End If
datPrimaryRS.Recordset.Filter = "" 'adFilterNone
datPrimaryRS.Recordset.Filter = strFilter
Adodc2.Recordset.Filter = "" 'adFilterNone
Adodc2.Recordset.Filter = strFilter2
SSTab1.Tab = 1
End Sub
Private Sub cmdPrint_Click()
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
Dim DataArray() As Variant
Dim i, j, Num As Integer
Screen.MousePointer = vbHourglass
'Start a new workbook in Excel
Set oExcel = CreateObject("Excel.Application")
Set oBook = oExcel.Workbooks.Add
'Create an array
Num = Adodc2.Recordset.RecordCount
If Num = 0 Then
MsgBox "发排数据为空。", vbInformation
Exit Sub
End If
ReDim DataArray(1 To Num, 1 To 13) As Variant
Adodc2.Recordset.MoveFirst
For i = 1 To Num
For j = 1 To 13
DataArray(i, j) = Adodc2.Recordset.Fields(j - 1).Value
Next
Adodc2.Recordset.MoveNext
Next
Adodc2.Recordset.MoveFirst
'Add headers to the worksheet on row 1
Set oSheet = oBook.Worksheets(1)
oSheet.Range("A1:M1").Select
With oExcel.Selection
.HorizontalAlignment = -4108
.VerticalAlignment = -4108
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
oSheet.Range("A1").Value = "技术资料登记帐"
oSheet.Range("A2").Value = " 年 月 日"
oSheet.Range("B2").Value = "总号"
oSheet.Range("C2").Value = "分类"
oSheet.Range("D2").Value = "文别"
oSheet.Range("E2").Value = "密别"
oSheet.Range("F2").Value = "资料名称"
oSheet.Range("G2").Value = "编制单位"
oSheet.Range("H2").Value = "编制日期"
oSheet.Range("I2").Value = "来源"
oSheet.Range("J2").Value = "份数"
oSheet.Range("K2").Value = "页数"
oSheet.Range("L2").Value = "单价"
oSheet.Range("M2").Value = "备注"
oSheet.Range("A2:M2").Select
With oExcel.Selection
.HorizontalAlignment = -4108
.VerticalAlignment = -4108
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
End With
'Transfer the array to the worksheet starting at cell A2
oSheet.Range("A3").Resize(Num, 13).Value = DataArray
oSheet.Range("A2:M" & CStr(Num + 2)).Select
oExcel.Selection.Borders(5).LineStyle = -4142
oExcel.Selection.Borders(6).LineStyle = -4142
With oExcel.Selection.Borders(7)
.LineStyle = 1
.Weight = 3
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(8)
.LineStyle = 1
.Weight = 3
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(9)
.LineStyle = 1
.Weight = 3
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(10)
.LineStyle = 1
.Weight = 3
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(11)
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End With
With oExcel.Selection.Borders(12)
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End With
' oSheet.Range("E" & CStr(Num + 3)).Value = "合计"
' oSheet.Range("F" & CStr(Num + 3)).Formula = "=SUM(F3:F" & CStr(Num + 2) & ")"
' oSheet.Range("G" & CStr(Num + 3)).Formula = "=SUM(G3:G" & CStr(Num + 2) & ")"
oSheet.Columns("A:A").EntireColumn.AutoFit
oSheet.Columns("B:B").EntireColumn.AutoFit
oSheet.Columns("C:C").EntireColumn.AutoFit
oSheet.Columns("D:D").EntireColumn.AutoFit
oSheet.Columns("E:E").EntireColumn.AutoFit
oSheet.Columns("F:F").EntireColumn.AutoFit
oSheet.Columns("G:G").EntireColumn.AutoFit
oSheet.Columns("H:H").EntireColumn.AutoFit
oSheet.Columns("I:I").EntireColumn.AutoFit
oSheet.Columns("J:J").EntireColumn.AutoFit
oSheet.Columns("K:K").EntireColumn.AutoFit
oSheet.Columns("L:L").EntireColumn.AutoFit
oSheet.Columns("M:M").EntireColumn.AutoFit
With oSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
oSheet.PageSetup.PrintArea = ""
With oSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = oExcel.InchesToPoints(0.75)
.RightMargin = oExcel.InchesToPoints(0.75)
.TopMargin = oExcel.InchesToPoints(1)
.BottomMargin = oExcel.InchesToPoints(1)
.HeaderMargin = oExcel.InchesToPoints(0.5)
.FooterMargin = oExcel.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = -4142
.CenterHorizontally = False
.CenterVertically = False
.Orientation = 2
.Draft = False
.PaperSize = 12
.FirstPageNumber = -4105
.Order = 1
.BlackAndWhite = False
.Zoom = 100
End With
oSheet.Range("A1").Select
oExcel.Visible = True
Screen.MousePointer = vbDefault
Set oExcel = Nothing
Set oBook = Nothing
Set oSheet = Nothing
End Sub
Private Sub cmdRefresh_Click()
'只有多用户应用程序需要
On Error GoTo RefreshErr
datPrimaryRS.Refresh
Exit Sub
RefreshErr:
MsgBox Err.Description
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
datPrimaryRS.Recordset.UpdateBatch adAffectAll
Exit Sub
UpdateErr:
MsgBox Err.Description
End Sub
Private Sub datPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
datPrimaryRS.Caption = CStr(datPrimaryRS.Recordset.AbsolutePosition)
lbl记录数.Caption = CStr(datPrimaryRS.Recordset.RecordCount)
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Select Case SSTab1.Tab
Case 0
If Not (Adodc2.Recordset.EOF Or Adodc2.Recordset.BOF) Then
datPrimaryRS.Recordset.MoveFirst
datPrimaryRS.Recordset.Find "总号 = " & Adodc2.Recordset.Fields("总号").Value, , adSearchForward, 0
End If
Case 1
If PreviousTab = 0 Then
Adodc2.Refresh
If Not (datPrimaryRS.Recordset.EOF Or datPrimaryRS.Recordset.BOF) Then
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Find "总号 = " & datPrimaryRS.Recordset.Fields("总号").Value, , adSearchForward, 0
End If
End If
End Select
End Sub
Private Sub UserDocument_Initialize()
With datPrimaryRS
.ConnectionString = pConn
.RecordSource = "select 总号,登记日期,分类id,文别,密别,资料名称,编制单位,编制日期,来源,份数,页数,单价,备注 from 技术资料 Order by 总号"
.Refresh
End With
With Adodc1
.ConnectionString = pConn
.RecordSource = "图书分类"
.Refresh
End With
With Adodc2
.ConnectionString = pConn
.RecordSource = "SELECT 技术资料.登记日期, 技术资料.总号, 图书分类.分类, 技术资料.文别, " & _
"技术资料.密别, 技术资料.资料名称, 技术资料.编制单位, " & _
"技术资料.编制日期, 技术资料.来源, 技术资料.份数, 技术资料.页数, " & _
"技术资料.单价, 技术资料.备注 " & _
"FROM 技术资料 LEFT OUTER JOIN " & _
"图书分类 ON 技术资料.分类id = 图书分类.分类ID"
.Refresh
End With
End Sub
Private Sub UserDocument_Show()
datPrimaryRS.Refresh
End Sub