📄 form5.frm
字号:
VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "crystl32.ocx"
Begin VB.Form report2
BorderStyle = 1 'Fixed Single
Caption = "个人简历报表"
ClientHeight = 1830
ClientLeft = 45
ClientTop = 330
ClientWidth = 5055
ControlBox = 0 'False
LinkTopic = "Form5"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1830
ScaleWidth = 5055
StartUpPosition = 2 'CenterScreen
Begin Crystal.CrystalReport cr1
Left = 2640
Top = 0
_ExtentX = 741
_ExtentY = 741
_Version = 262150
WindowState = 2
End
Begin VB.OptionButton Option2
Caption = "自定义类型"
Height = 495
Left = 720
TabIndex = 4
Top = 840
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "Excel类型"
Height = 495
Left = 720
TabIndex = 3
Top = 480
Value = -1 'True
Width = 1215
End
Begin VB.Frame Frame1
Caption = "报表类型"
Height = 1215
Left = 360
TabIndex = 2
Top = 240
Width = 2535
End
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 495
Left = 3240
TabIndex = 1
Top = 960
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "打开报表"
Height = 495
Left = 3240
TabIndex = 0
Top = 360
Width = 1455
End
End
Attribute VB_Name = "report2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim exlapp As New Excel.Application
Dim exlbook As Excel.Workbook
Dim exlsheet As Excel.Worksheet
Dim rsprl As ADODB.Recordset
Private Sub Command1_Click()
If Option1.Value = True Then
Dim rows As Integer
rows = 2
If rsprl.RecordCount > 0 Then
While Not rsprl.EOF
With exlapp.Sheets(1)
For i = 0 To 5
.Cells(rows, i + 1) = rsprl.Fields(i)
Next i
rsprl.MoveNext
rows = rows + 1
End With
Wend
exlapp.Visible = True
Else
MsgBox "database error!"
End If
End If
If Option2.Value = True Then
With cr1
.ReportFileName = "e:\prl.rpt"
.Action = 1
End With
'drp2.Visible = True
End If
End Sub
Private Sub Command2_Click()
Unload Me
frmmain.Visible = True
End Sub
Private Sub Form_Load()
Set exlapp = New Excel.Application
exlapp.Workbooks.Open "e:\man\prl.xlt"
Set rsprl = New ADODB.Recordset
rsprl.Open "select * from prl", cn, adOpenStatic, adLockOptimistic
End Sub
Private Sub Form_Unload(Cancel As Integer)
rsprl.Close
Set rsprl = Nothing
exlapp.quit
End Sub
Private Sub Option1_GotFocus()
Option1.Value = True
End Sub
Private Sub Option2_GotFocus()
Option2.Value = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -