📄 mdb.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form mdb
BorderStyle = 3 'Fixed Dialog
Caption = "MDB数据库数据处理系统2004"
ClientHeight = 4740
ClientLeft = 45
ClientTop = 330
ClientWidth = 6975
Icon = "mdb.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4740
ScaleWidth = 6975
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command7
Caption = "Html 报表"
Enabled = 0 'False
Height = 375
Left = 5520
TabIndex = 15
Top = 3720
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "Excel报表"
Enabled = 0 'False
Height = 375
Left = 5520
TabIndex = 14
Top = 3360
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "Word 报表"
Enabled = 0 'False
Height = 375
Left = 5520
MouseIcon = "mdb.frx":0442
MousePointer = 99 'Custom
TabIndex = 9
Top = 3000
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "文本报表"
Enabled = 0 'False
Height = 375
Left = 5520
MouseIcon = "mdb.frx":0594
MousePointer = 99 'Custom
TabIndex = 12
Top = 2640
Width = 1215
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 3600
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 0
Visible = 0 'False
Width = 2535
End
Begin VB.CommandButton Command4
Caption = "数据查询"
Enabled = 0 'False
Height = 375
Left = 5520
MouseIcon = "mdb.frx":06E6
MousePointer = 99 'Custom
TabIndex = 11
Top = 2280
Width = 1215
End
Begin VB.ListBox List1
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2160
Left = 240
MouseIcon = "mdb.frx":0838
MousePointer = 99 'Custom
TabIndex = 8
Top = 1920
Width = 5055
End
Begin VB.TextBox Text1
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 345
Left = 240
Locked = -1 'True
TabIndex = 5
Top = 1200
Width = 5055
End
Begin VB.CommandButton Command2
Caption = "数据修改"
Enabled = 0 'False
Height = 375
Left = 5520
MouseIcon = "mdb.frx":098A
MousePointer = 99 'Custom
TabIndex = 1
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "打开数据库"
Height = 375
Left = 5520
MouseIcon = "mdb.frx":0ADC
MousePointer = 99 'Custom
TabIndex = 0
Top = 1200
Width = 1215
End
Begin MSComDlg.CommonDialog cd1
Left = 4800
Top = 720
_ExtentX = 847
_ExtentY = 847
_Version = 393216
DefaultExt = ".mdb"
Filter = "Access(*.mdb)|*.mdb"
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "编著:(C)蒲应文"
ForeColor = &H00FF0000&
Height = 180
Left = 5490
TabIndex = 13
Top = 4320
Width = 1260
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "说明:数据修改只能处理数据表中的前100个项目(字段)。"
ForeColor = &H00000000&
Height = 180
Left = 240
TabIndex = 10
Top = 4320
Width = 4770
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "数据表:"
Height = 180
Left = 240
TabIndex = 7
Top = 1680
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "数据库:"
Height = 180
Left = 240
TabIndex = 6
Top = 960
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "MDB数据库数据处理系统2004"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 480
TabIndex = 4
Top = 240
Width = 6255
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "MDB数据库数据处理系统2004"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00404040&
Height = 495
Left = 1680
TabIndex = 3
Top = 240
Width = 6255
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "MDB数据库数据处理系统2004"
BeginProperty Font
Name = "宋体"
Size = 24
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 495
Left = 0
TabIndex = 2
Top = 240
Width = 6255
End
End
Attribute VB_Name = "mdb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim tbl As TableDef
'自定义报表生成函数
Sub mdb2html(MdbFn As String, TableName As String, HtmlFn As String, Lines As Integer)
'打开数据库
If Dir(MdbFn) = "" Then
MsgBox "找不到数据库文件:" + MdbFn, vbCritical
Exit Sub
End If
On Error Resume Next
Data1.DatabaseName = MdbFn
Data1.RecordSource = TableName
Data1.Refresh
'字段数
n = Data1.Recordset.Fields.Count
Data1.Recordset.MoveLast
'记录数
rs = Data1.Recordset.AbsolutePosition + 1
If rs = 0 Then
MsgBox "表中没有记录! ", vbCritical
Exit Sub
End If
Data1.Recordset.MoveFirst
'创建超文本文件
Open HtmlFn For Output As #1
Print #1, "<html>"
Print #1, "<head>"
Print #1, "<title>" & MdbFn & "</title>"
Print #1, "</head>"
Print #1, "<body>"
Print #1, "<p> 记录数:" & CStr(rs) & "</p>"
p = 0
'如果参数:ines=-1,表示不分页
If Lines = -1 Then Lines = rs
While Not Data1.Recordset.EOF
'表头
Print #1, "<table border=1 align=center>"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -