⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#4.6#0"; "CRYSTL32.OCX"
Begin VB.Form Form1 
   Caption         =   "报表打印"
   ClientHeight    =   4125
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3870
   LinkTopic       =   "Form1"
   ScaleHeight     =   4125
   ScaleWidth      =   3870
   StartUpPosition =   3  '窗口缺省
   Begin VB.CheckBox Check1 
      Caption         =   "预览窗口最大化"
      Height          =   375
      Left            =   960
      TabIndex        =   4
      Top             =   1080
      Width           =   1575
   End
   Begin VB.TextBox Text2 
      DataSource      =   "Data1"
      Height          =   375
      Left            =   960
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   2160
      Width           =   2295
   End
   Begin VB.TextBox Text1 
      DataSource      =   "Data1"
      Height          =   375
      Left            =   960
      TabIndex        =   2
      Text            =   "Text1"
      Top             =   1560
      Width           =   2295
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   525
      Left            =   960
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   240
      Width           =   2055
   End
   Begin VB.CommandButton Command2 
      Caption         =   "打印当前记录"
      Height          =   495
      Left            =   2040
      TabIndex        =   1
      Top             =   2880
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "打印所有记录"
      Height          =   495
      Left            =   240
      TabIndex        =   0
      Top             =   2880
      Width           =   1335
   End
   Begin Crystal.CrystalReport CrystalReport1 
      Left            =   360
      Top             =   240
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   262150
   End
   Begin VB.Label Label2 
      Caption         =   "邮箱"
      Height          =   180
      Left            =   360
      TabIndex        =   6
      Top             =   2160
      Width           =   360
   End
   Begin VB.Label Label1 
      Caption         =   "姓名"
      Height          =   180
      Left            =   360
      TabIndex        =   5
      Top             =   1560
      Width           =   360
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
    If Check1.Value = 0 Then
        CrystalReport1.WindowState = crptNormal
    End If
    If Check1.Value = 1 Then
        CrystalReport1.WindowState = crptMaximized
    End If
End Sub

Private Sub Command1_Click()
    CrystalReport1.Action = 1
End Sub

Private Sub Command2_Click()
    k = "{zmhh.name}='" + Text1.Text + "'"
    CrystalReport1.SelectionFormula = k
    CrystalReport1.Action = 1
End Sub



Private Sub Form_Load()
    Data1.DatabaseName = App.Path + "\zmhh.mdb"
    Data1.RecordSource = "zmhh"
    Data1.Refresh
    Text1.DataField = "name"
    Text2.DataField = "mail"
    CrystalReport1.DataFiles(0) = Data1.DatabaseName
    CrystalReport1.ReportFileName = App.Path + "\zmhh.rpt"
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -