home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Main
- BorderStyle = 3 'Fixed Dialog
- Caption = "Crystal Reports OCX Demo Application"
- ClientHeight = 6375
- ClientLeft = 870
- ClientTop = 1425
- ClientWidth = 10260
- Height = 6780
- Icon = "Main.frx":0000
- Left = 810
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 425
- ScaleMode = 3 'Pixel
- ScaleWidth = 684
- ShowInTaskbar = 0 'False
- Top = 1080
- Width = 10380
- Begin VB.Timer Timer1
- Left = 9600
- Top = 0
- End
- Begin VB.CommandButton CmdCancel
- Caption = "Cancel"
- Height = 375
- Left = 8400
- TabIndex = 17
- Top = 5760
- Width = 1575
- End
- Begin VB.CommandButton CmdAccept
- Caption = "Print Report"
- Height = 375
- Left = 6720
- TabIndex = 16
- Top = 5760
- Width = 1455
- End
- Begin VB.CommandButton CmdNext
- Caption = "Next >>"
- Height = 375
- Left = 2040
- TabIndex = 15
- Top = 5760
- Width = 1455
- End
- Begin VB.CommandButton CmdBack
- Caption = "<< Back "
- Height = 375
- Left = 360
- TabIndex = 14
- Top = 5760
- Width = 1455
- End
- Begin TabDlg.SSTab MainTab
- Height = 5415
- Left = 360
- TabIndex = 0
- Top = 240
- Width = 9615
- _Version = 65536
- _ExtentX = 16960
- _ExtentY = 9551
- _StockProps = 15
- Caption = "Set Report Formulas"
- TabsPerRow = 5
- Tab = 3
- TabOrientation = 0
- Tabs = 5
- Style = 1
- TabMaxWidth = 265
- TabHeight = 529
- TabCaption(0) = "Open a Crystal Report"
- Tab(0).ControlCount= 1
- Tab(0).ControlEnabled= 0 'False
- Tab(0).Control(0)= "Frame1"
- TabCaption(1) = "Destination"
- Tab(1).ControlCount= 1
- Tab(1).ControlEnabled= 0 'False
- Tab(1).Control(0)= "Frame4"
- TabCaption(2) = "Database Location"
- Tab(2).ControlCount= 1
- Tab(2).ControlEnabled= 0 'False
- Tab(2).Control(0)= "Frame9"
- TabCaption(3) = "Set Report Formulas"
- Tab(3).ControlCount= 1
- Tab(3).ControlEnabled= -1 'True
- Tab(3).Control(0)= "Frame5"
- TabCaption(4) = "About the OCX Demo"
- Tab(4).ControlCount= 1
- Tab(4).ControlEnabled= 0 'False
- Tab(4).Control(0)= "Frame20"
- Begin VB.Frame Frame20
- Height = 4695
- Left = -74760
- TabIndex = 81
- Top = 480
- Width = 9135
- Begin VB.Frame Frame23
- Height = 2655
- Left = 120
- TabIndex = 83
- Top = 1920
- Width = 8895
- Begin VB.Label Label23
- Caption = "800-877-2340 (U.S.) 800-663-1244 (Canada) 604-681-3435 E-Mail: sales@crystalinc.com"
- Height = 855
- Left = 3600
- TabIndex = 105
- Top = 1680
- Width = 2175
- End
- Begin VB.Label Label22
- Caption = "You can also Contact Crystal directly at:"
- Height = 255
- Left = 480
- TabIndex = 104
- Top = 1680
- Width = 3015
- End
- Begin VB.Label Label21
- Caption = "Or, GO REPORTS on CompuServe to visit the Crystal Reports section of the Windows Components B Forum"
- Height = 255
- Left = 480
- TabIndex = 103
- Top = 1440
- Width = 7935
- End
- Begin VB.Label Label19
- Alignment = 2 'Center
- Caption = $"Main.frx":030A
- Height = 495
- Left = 360
- TabIndex = 102
- Top = 960
- Width = 8055
- End
- Begin VB.Label Label16
- Alignment = 2 'Center
- Caption = "Crystal Reports is the #1 award-winning reporting tool with over 1 million copies shipped."
- Height = 255
- Left = 1200
- TabIndex = 88
- Top = 720
- Width = 6375
- End
- Begin VB.Label Label15
- Alignment = 2 'Center
- Caption = "Copyright
- 1995 Crystal Computer Services Inc. A Seagate Software Company"
- Height = 495
- Left = 2640
- TabIndex = 87
- Top = 240
- Width = 3615
- End
- End
- Begin VB.Frame Frame22
- Height = 1695
- Left = 120
- TabIndex = 82
- Top = 120
- Width = 8895
- Begin VB.PictureBox Picture1
- AutoSize = -1 'True
- Height = 510
- Left = 240
- Picture = "Main.frx":03B7
- ScaleHeight = 480
- ScaleWidth = 480
- TabIndex = 86
- Top = 360
- Width = 510
- End
- Begin VB.Label Label14
- Alignment = 2 'Center
- Caption = $"Main.frx":06C1
- Height = 855
- Left = 840
- TabIndex = 85
- Top = 720
- Width = 7455
- End
- Begin VB.Label Label13
- Alignment = 2 'Center
- Caption = "Crystal Reports for Visual Basic Professional 4.0 Sample Application using the Crystal 32-Bit OLE Control."
- Height = 615
- Left = 1800
- TabIndex = 84
- Top = 240
- Width = 5055
- End
- End
- End
- Begin VB.Frame Frame9
- Height = 4695
- Left = -74760
- TabIndex = 10
- Top = 480
- Width = 9135
- Begin VB.CommandButton CmdSecurity
- Caption = "Set Security"
- Enabled = 0 'False
- Height = 375
- Left = 5160
- TabIndex = 68
- Top = 4200
- Width = 1575
- End
- Begin VB.CommandButton CmdConnect
- Caption = "Connect"
- Height = 375
- Left = 7200
- TabIndex = 67
- Top = 4200
- Width = 1815
- End
- Begin VB.Frame Frame14
- Caption = "ODBC Connection:"
- Height = 1095
- Left = 120
- TabIndex = 51
- Top = 240
- Width = 8895
- Begin VB.TextBox TxtDSQ
- Height = 285
- Left = 6120
- TabIndex = 66
- Top = 600
- Width = 2655
- End
- Begin VB.TextBox TxtPWD
- Height = 285
- Left = 1800
- PasswordChar = "*"
- TabIndex = 65
- Top = 600
- Width = 2535
- End
- Begin VB.TextBox TxtUID
- Height = 285
- Left = 6120
- TabIndex = 62
- Top = 240
- Width = 2655
- End
- Begin VB.TextBox TxtDSN
- Height = 285
- Left = 1800
- TabIndex = 59
- Top = 240
- Width = 2535
- End
- Begin VB.Label Label8
- Caption = "Database Qualifier:"
- Height = 255
- Left = 4440
- TabIndex = 64
- Top = 720
- Width = 1455
- End
- Begin VB.Label Label7
- Caption = "User ID:"
- Height = 255
- Left = 4440
- TabIndex = 63
- Top = 360
- Width = 1095
- End
- Begin VB.Label Label6
- Caption = "Password:"
- Height = 255
- Left = 240
- TabIndex = 61
- Top = 720
- Width = 1455
- End
- Begin VB.Label Label3
- Caption = "Data Source Name:"
- Height = 255
- Left = 240
- TabIndex = 60
- Top = 360
- Width = 1455
- End
- End
- Begin VB.Frame Frame6
- Caption = "Database/Access Security:"
- Height = 2655
- Left = 120
- TabIndex = 41
- Top = 1440
- Width = 8895
- Begin VB.Frame Frame13
- Caption = "Database:"
- Height = 2295
- Left = 3600
- TabIndex = 45
- Top = 240
- Width = 5175
- Begin VB.TextBox TxtPassword
- Height = 285
- Left = 2760
- MaxLength = 14
- PasswordChar = "*"
- TabIndex = 48
- Top = 1800
- Width = 2295
- End
- Begin VB.TextBox TxtUserName
- Height = 285
- Left = 120
- MaxLength = 20
- TabIndex = 47
- Top = 1800
- Width = 2295
- End
- Begin VB.FileListBox DataFileList
- Height = 1005
- Left = 120
- Pattern = "*.mdb"
- TabIndex = 46
- Top = 240
- Width = 4935
- End
- Begin VB.Label Label5
- Caption = "Password:"
- Height = 255
- Left = 2760
- TabIndex = 50
- Top = 1560
- Width = 2295
- End
- Begin VB.Label Label4
- Caption = "User Name:"
- Height = 255
- Left = 120
- TabIndex = 49
- Top = 1560
- Width = 2295
- End
- End
- Begin VB.Frame Frame8
- Caption = "Directory:"
- Height = 2295
- Left = 120
- TabIndex = 42
- Top = 240
- Width = 3375
- Begin VB.DirListBox DataDirList
- Height = 1380
- Left = 120
- TabIndex = 44
- Top = 240
- Width = 3135
- End
- Begin VB.DriveListBox DataDriveList
- Height = 315
- Left = 120
- TabIndex = 43
- Top = 1800
- Width = 3135
- End
- End
- End
- End
- Begin VB.Frame Frame5
- Height = 4695
- Left = 240
- TabIndex = 8
- Top = 480
- Width = 9015
- Begin VB.CommandButton CmdClrFormula
- Caption = "Clear Formula Text"
- Height = 375
- Left = 7200
- TabIndex = 71
- Top = 4200
- Width = 1575
- End
- Begin VB.CommandButton CmdAccptFormula
- Caption = "Accept Formula"
- Height = 375
- Left = 5280
- TabIndex = 70
- Top = 4200
- Width = 1575
- End
- Begin TabDlg.SSTab FormulaTab
- Height = 3735
- Left = 240
- TabIndex = 9
- Top = 360
- Width = 8535
- _Version = 65536
- _ExtentX = 15055
- _ExtentY = 6588
- _StockProps = 15
- Caption = "Report Formula"
- TabsPerRow = 4
- Tab = 0
- TabOrientation = 0
- Tabs = 4
- Style = 1
- TabMaxWidth = 0
- TabHeight = 529
- TabCaption(0) = "Report Formula"
- Tab(0).ControlCount= 1
- Tab(0).ControlEnabled= -1 'True
- Tab(0).Control(0)= "Frame10"
- TabCaption(1) = "Record Selection Formula"
- Tab(1).ControlCount= 1
- Tab(1).ControlEnabled= 0 'False
- Tab(1).Control(0)= "Frame11"
- TabCaption(2) = "Group Selection Formula"
- Tab(2).ControlCount= 1
- Tab(2).ControlEnabled= 0 'False
- Tab(2).Control(0)= "Frame12"
- TabCaption(3) = "Record/Group Sort Orders"
- Tab(3).ControlCount= 1
- Tab(3).ControlEnabled= 0 'False
- Tab(3).Control(0)= "Frame16"
- Begin VB.Frame Frame16
- Height = 3015
- Left = -74760
- TabIndex = 73
- Top = 480
- Width = 8055
- Begin VB.Frame Frame18
- Caption = "Group Sort Order"
- Height = 2655
- Left = 4080
- TabIndex = 75
- Top = 240
- Width = 3855
- Begin VB.CommandButton CmdGrpClear
- Caption = "Clear G&roup Sort"
- Height = 375
- Left = 2160
- TabIndex = 98
- Top = 2160
- Width = 1500
- End
- Begin VB.CommandButton CmdGrpSort
- Caption = "Set &Group Sort"
- Height = 375
- Left = 240
- TabIndex = 97
- Top = 2160
- Width = 1500
- End
- Begin VB.OptionButton OptGrpSort
- Caption = "Descending"
- Height = 255
- Index = 1
- Left = 2040
- TabIndex = 96
- Top = 840
- Width = 1575
- End
- Begin VB.OptionButton OptGrpSort
- Caption = "Ascending"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 95
- Top = 840
- Value = -1 'True
- Width = 1935
- End
- Begin VB.TextBox TxtGrpSort
- Height = 285
- Left = 120
- TabIndex = 94
- Top = 360
- Width = 3615
- End
- Begin VB.Label Label24
- Caption = "e.g. Sum ({empdata.salary}, {empdata.empnum})"
- Height = 255
- Left = 240
- TabIndex = 106
- Top = 1850
- Width = 3495
- End
- Begin VB.Label Label20
- Caption = "The group field being entered into the textbox must be entered using the same syntax as is entered into Crystal Reports."
- Height = 615
- Left = 240
- TabIndex = 99
- Top = 1200
- Width = 3495
- End
- End
- Begin VB.Frame Frame17
- Caption = "Record Sort Order"
- Height = 2655
- Left = 120
- TabIndex = 74
- Top = 240
- Width = 3855
- Begin VB.CommandButton CmdRecSort
- Caption = "&Set Record Sort"
- Height = 375
- Left = 240
- TabIndex = 93
- Top = 2160
- Width = 1500
- End
- Begin VB.CommandButton CmdRecClear
- Caption = "&Clear Record Sort"
- Height = 375
- Left = 2160
- TabIndex = 92
- Top = 2160
- Width = 1500
- End
- Begin VB.OptionButton OptRecSort
- Caption = "Descending"
- Height = 255
- Index = 1
- Left = 2040
- TabIndex = 90
- Top = 840
- Width = 1335
- End
- Begin VB.OptionButton OptRecSort
- Caption = "Ascending"
- Height = 255
- Index = 0
- Left = 120
- TabIndex = 89
- Top = 840
- Value = -1 'True
- Width = 1095
- End
- Begin VB.TextBox TxtRecSort
- Height = 285
- Left = 120
- TabIndex = 76
- Top = 360
- Width = 3615
- End
- Begin VB.Label Label17
- Caption = "e.g. {Empdata.Salary}"
- Height = 255
- Left = 120
- TabIndex = 100
- Top = 1850
- Width = 3495
- End
- Begin VB.Label Label18
- Caption = $"Main.frx":0829
- Height = 615
- Left = 120
- TabIndex = 91
- Top = 1200
- Width = 3375
- End
- End
- End
- Begin VB.CommandButton CmdAccptFormulas
- Caption = "Accept Formula"
- Height = 375
- Left = -68400
- TabIndex = 69
- Top = 3600
- Width = 1695
- End
- Begin VB.Frame Frame12
- Height = 3015
- Left = -74760
- TabIndex = 13
- Top = 480
- Width = 8055
- Begin VB.Frame Frame21
- Height = 975
- Left = 120
- TabIndex = 80
- Top = 1920
- Width = 7815
- Begin VB.Label Label12
- Caption = $"Main.frx":08C3
- Height = 615
- Left = 120
- TabIndex = 101
- Top = 240
- Width = 7575
- End
- End
- Begin VB.TextBox TxtGrpSelFormula
- Height = 1695
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 58
- Top = 240
- Width = 7815
- End
- Begin VB.Label Label9
- Height = 855
- Left = 120
- TabIndex = 77
- Top = 2040
- Width = 7815
- End
- End
- Begin VB.Frame Frame11
- Height = 3015
- Left = -74760
- TabIndex = 12
- Top = 480
- Width = 8055
- Begin VB.Frame Frame19
- Height = 975
- Left = 120
- TabIndex = 78
- Top = 1920
- Width = 7815
- Begin VB.Label Label11
- Caption = $"Main.frx":09DB
- Height = 615
- Left = 120
- TabIndex = 79
- Top = 240
- Width = 7575
- End
- End
- Begin VB.TextBox TxtRecSelFormula
- Height = 1695
- Left = 120
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 57
- Top = 240
- Width = 7815
- End
- End
- Begin VB.Frame Frame10
- Height = 3015
- Left = 240
- TabIndex = 11
- Top = 480
- Width = 8055
- Begin VB.Frame Frame15
- Caption = "Formula Text:"
- Height = 2055
- Left = 120
- TabIndex = 55
- Top = 840
- Width = 7815
- Begin VB.TextBox TxtFormula
- Height = 1695
- Left = 120
- MaxLength = 255
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 56
- Top = 240
- Width = 7575
- End
- End
- Begin VB.TextBox TxtFormulaName
- Height = 285
- Left = 1560
- TabIndex = 53
- Top = 360
- Width = 2655
- End
- Begin VB.Label Label2
- Caption = "This formula must be entered using the same syntax of the Formula Editor."
- Height = 375
- Left = 4440
- TabIndex = 54
- Top = 360
- Width = 3375
- End
- Begin VB.Label Label1
- Caption = "Formula Name:"
- Height = 255
- Left = 180
- TabIndex = 52
- Top = 480
- Width = 1215
- End
- End
- End
- Begin VB.Label Label10
- Caption = $"Main.frx":0AF5
- Height = 405
- Left = 240
- TabIndex = 72
- Top = 4200
- Width = 5055
- End
- End
- Begin VB.Frame Frame4
- Height = 4695
- Left = -74640
- TabIndex = 7
- Top = 480
- Width = 9015
- Begin VB.Frame FrmPrinter
- Caption = "Print to a Printer:"
- Height = 735
- Left = 3840
- TabIndex = 21
- Top = 1080
- Width = 5055
- Begin VB.TextBox TxtPrnCopies
- Height = 315
- Left = 3840
- TabIndex = 40
- Text = "1"
- Top = 280
- Width = 495
- End
- Begin Spin.SpinButton SpinButton1
- Height = 315
- Left = 4560
- TabIndex = 39
- Top = 285
- Width = 375
- _Version = 65536
- _ExtentX = 661
- _ExtentY = 556
- _StockProps = 73
- ForeColor = 12632256
- TdThickness = 2
- End
- Begin VB.Label LblPrnCopies
- Caption = "Number of Copies to send to Printer:"
- Height = 255
- Left = 120
- TabIndex = 37
- Top = 360
- Width = 2655
- End
- End
- Begin VB.Frame FrmWin
- Caption = "Print to a Window:"
- Height = 735
- Left = 3840
- TabIndex = 20
- Top = 240
- Width = 5055
- Begin VB.TextBox TxtWinTitle
- Height = 285
- Left = 1560
- TabIndex = 32
- Top = 240
- Width = 3375
- End
- Begin VB.Label LblWinTitle
- Caption = "Window Title:"
- Height = 255
- Left = 120
- TabIndex = 38
- Top = 360
- Width = 1215
- End
- End
- Begin VB.Frame Frame7
- BackColor = &H00C0C0C0&
- Caption = "Destination Selection:"
- Height = 1575
- Left = 120
- TabIndex = 19
- Top = 240
- Width = 3615
- Begin VB.OptionButton OptFile
- BackColor = &H00C0C0C0&
- Caption = "Print to a File"
- Height = 255
- Left = 360
- TabIndex = 35
- Top = 1080
- Width = 1575
- End
- Begin VB.OptionButton OptPrinter
- Caption = "Print to a Printer"
- Height = 255
- Left = 360
- TabIndex = 34
- Top = 720
- Width = 1455
- End
- Begin VB.OptionButton OptWindow
- BackColor = &H00C0C0C0&
- Caption = "Print to a Window"
- Height = 255
- Left = 360
- TabIndex = 33
- Top = 360
- Width = 1575
- End
- End
- Begin VB.Frame FrmFile
- Caption = "Print to File:"
- ForeColor = &H00000000&
- Height = 2655
- Left = 120
- TabIndex = 18
- Top = 1920
- Width = 8775
- Begin VB.TextBox TxtPrnFileName
- Height = 285
- Left = 5880
- TabIndex = 31
- Top = 360
- Width = 2775
- End
- Begin VB.Frame FrmFileType
- Caption = "File Type:"
- Height = 1335
- Left = 4440
- TabIndex = 24
- Top = 1200
- Width = 4215
- Begin VB.OptionButton OptTabSepText
- Caption = "Tab-Seperated Text"
- Height = 255
- Left = 2040
- TabIndex = 30
- Top = 960
- Width = 1815
- End
- Begin VB.OptionButton OptRecord
- Caption = "Record"
- Height = 255
- Left = 2040
- TabIndex = 29
- Top = 600
- Width = 1335
- End
- Begin VB.OptionButton OptText
- Caption = "Text"
- Height = 255
- Left = 360
- TabIndex = 28
- Top = 240
- Width = 855
- End
- Begin VB.OptionButton OptCSV
- Caption = "CSV"
- Height = 255
- Left = 2040
- TabIndex = 27
- Top = 240
- Width = 1215
- End
- Begin VB.OptionButton OptDIF
- Caption = "DIF"
- Height = 255
- Left = 360
- TabIndex = 26
- Top = 600
- Width = 975
- End
- Begin VB.OptionButton OptTabSep
- Caption = "Tab-Seperated"
- Height = 255
- Left = 360
- TabIndex = 25
- Top = 960
- Width = 1575
- End
- End
- Begin VB.DirListBox PrnFileDir
- Height = 1830
- Left = 120
- TabIndex = 23
- Top = 240
- Width = 2655
- End
- Begin VB.DriveListBox PrnFileDrive
- Height = 315
- Left = 120
- TabIndex = 22
- Top = 2160
- Width = 2655
- End
- Begin VB.Label LblFileName
- Caption = "File Name:"
- Height = 255
- Left = 4560
- TabIndex = 36
- Top = 480
- Width = 975
- End
- End
- End
- Begin VB.Frame Frame1
- Height = 4695
- Left = -74640
- TabIndex = 1
- Top = 480
- Width = 9015
- Begin VB.Frame Frame3
- Caption = "Reports:"
- Height = 4215
- Left = 3480
- TabIndex = 3
- Top = 240
- Width = 5415
- Begin VB.FileListBox FileList
- DragIcon = "Main.frx":0B7F
- Height = 3735
- Left = 120
- Pattern = "*.rpt"
- TabIndex = 6
- Top = 240
- Width = 5175
- End
- End
- Begin VB.Frame Frame2
- Caption = "Directory:"
- Height = 4215
- Left = 240
- TabIndex = 2
- Top = 240
- Width = 3135
- Begin VB.DriveListBox DriveList
- Height = 315
- Left = 120
- TabIndex = 5
- Top = 3720
- Width = 2895
- End
- Begin VB.DirListBox DirList
- Height = 3405
- Left = 120
- TabIndex = 4
- Top = 240
- Width = 2895
- End
- End
- End
- End
- Begin Crystal.CrystalReport CrystalReport1
- Left = 120
- Top = 0
- _ExtentX = 741
- _ExtentY = 741
- _StockProps = 0
- ReportFileName = ""
- Destination = 0
- WindowLeft = 0
- WindowTop = 0
- WindowWidth = 640
- WindowHeight = 480
- WindowTitle = ""
- WindowBorderStyle= 2
- WindowControlBox= -1 'True
- WindowMaxButton = -1 'True
- WindowMinButton = -1 'True
- CopiesToPrinter = 1
- PrintFileName = ""
- PrintFileType = 0
- SelectionFormula= ""
- GroupSelectionFormula= ""
- Connect = ""
- UserName = ""
- ReportSource = 0
- BoundReportHeading= ""
- BoundReportFooter= 0 'False
- End
- Attribute VB_Name = "Main"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim FormulaNum As Integer ' Sets a variable to increment the CrystalReport1.Formulas
- ' array index for each formula that is being set. This value
- Dim RecSort As Integer
- Dim grpsort As Integer
- Private Sub CmdAccept_Click()
- Dim iCrystalError As Integer
- On Error GoTo ErrorHandler
- If CrystalReport1.Destination = 1 Then
- CrystalReport1.CopiesToPrinter = Val(TxtPrnCopies.Text)
- End If
- CrystalReport1.Action = 1
- ResetIndexes
- ErrorHandler:
- iCrystalError = CrystalReport1.LastErrorNumber
- PrintError (iCrystalError)
- Exit Sub
- End Sub
- Private Sub CmdAccptFormula_Click()
- Dim sFormulaText As String ' create avariable to hold the formula text
- ' that is entered by the user.
- Dim iFormulaTabNum As Integer ' hold the number of the tab selected.
- iFormulaTabNum = FormulaTab.Tab ' assign the Formula Tab's active tab number to
- ' to the FormulaTabNum variable.
-
- ' Depending on the active tab chosen, determine what formula is being edited and then assign
- ' the formula text to the appropriate formula property.
- Select Case iFormulaTabNum
- Case 0 ' sets the value for the CrystalReport1.Formulas(0) array property.
- sFormulaText = TxtFormulaName.Text & "= " & TxtFormula.Text
- CrystalReport1.Formulas(FormulaNum) = sFormulaText
- FormulaNum = FormulaNum + 1 ' increments the CrystalReport1.Formulas(0)
- ' array index.
- Case 1 ' Set the Record Selection Formula.
- CrystalReport1.SelectionFormula = TxtRecSelFormula.Text
- Case 2 ' Set the Group Selection Formula.
- CrystalReport1.GroupSelectionFormula = TxtGrpSelFormula.Text
- Case 3 ' Disables the "Accept Formula" command button
- CmdAccptFormula.Enabled = False ' when the user chooses the Record/Group Sort
- ' Orders tab.
- End Select
- End Sub
- Private Sub CmdBack_Click()
- If MainTab.Tab > 0 Then
- MainTab.Tab = MainTab.Tab - 1
- CmdNext.Enabled = True
- End If
- If MainTab.Tab < 1 Then
- CmdBack.Enabled = False
- End If
- End Sub
- Private Sub CmdCancel_Click()
- End ' Exit the program.
- End Sub
- Private Sub CmdClrFormula_Click()
- Dim iClearTabNum As Integer
- iClearTabNum = FormulaTab.Tab
- Select Case iClearTabNum
- Case 0
- TxtFormulaName.Text = " "
- TxtFormula.Text = " "
- CmdAccptFormula.Enabled = False
- Case 1
- TxtRecSelFormula.Text = " "
- CmdAccptFormula.Enabled = False
- Case 2
- TxtGrpSelFormula.Text = " "
- CmdAccptFormula.Enabled = False
- End Select
- End Sub
- Private Sub CmdConnect_Click()
- Dim sCnctStrng As String, sDataSrce As String, sUserID As String, sPwd As String, sDsqlfr As String
- sDataSrce = "DSN=" & TxtDSN.Text
- sUserID = "UID=" & TxtUID.Text
- sPwd = "PWD=" & TxtPWD.Text
- sDsqlfr = "DSQ=" & TxtDSQ.Text
- 'if TxtPWD.TEXT = " "
- CrystalReport1.Connect = sDataSrce & ";" & sUserID & ";" & sPwd & ";" & sDsqlfr
- MsgBox CrystalReport1.Connect
- End Sub
- Private Sub CmdGrpClear_Click()
- TxtGrpSort.Text = " "
- End Sub
- Private Sub CmdGrpSort_Click()
- Dim sortgrp As String
- If OptGrpSort(0).Value Then
- sortgrp = "+" & TxtGrpSort.Text
- sortgrp = "-" & TxtGrpSort.Text
- End If
- CrystalReport1.GroupSortFields(grpsort) = sortgrp
- grpsort = grpsort + 1
- End Sub
- Private Sub CmdNext_Click()
- If MainTab.Tab < MainTab.Tabs - 1 Then
- MainTab.Tab = MainTab.Tab + 1
- CmdBack.Enabled = True
- End If
- If MainTab.Tab = MainTab.Tabs - 1 Then
- CmdNext.Enabled = False
- End If
- End Sub
- Private Sub CmdRecClear_Click()
- TxtRecSort.Text = " "
- End Sub
- Private Sub CmdRecSort_Click()
- Dim sort As String
- If OptRecSort(0).Value Then
- sort = "+" & TxtRecSort.Text
- sort = "-" & TxtRecSort.Text
- End If
- CrystalReport1.SortFields(RecSort) = sort
- RecSort = RecSort + 1
- End Sub
- Private Sub CmdSecurity_Click()
- CrystalReport1.UserName = TxtUserName.Text
- CrystalReport1.Password = TxtPassword.Text
- End Sub
- Private Sub DataDirList_Change()
- DataFileList.Path = DataDirList.Path
- End Sub
- Private Sub DataDriveList_Change()
- DataDirList.Path = DataDriveList.Drive
- End Sub
- Private Sub DataFileList_DblClick()
- Dim sRptDataFile As String
- sRptDataFile = DataFileList.Path & "\" & DataFileList.filename
- CrystalReport1.DataFiles(0) = sRptDataFile
- End Sub
- Private Sub DirList_Change()
- FileList.Path = DirList.Path
- End Sub
- Private Sub DriveList_Change()
- DirList.Path = DriveList.Drive
- End Sub
- Private Sub FileList_DblClick()
- ' Sets a variable for the report filename, which requires both the path
- ' and file name to qualify
- Dim sReportFile As String
- sReportFile = FileList.Path & "\" & FileList.filename
- CrystalReport1.ReportFileName = sReportFile
- ResetIndexes
- Timer1.Interval = 2000 ' wait 2 seconds before enabaling all other tabs,
- With MainTab ' and then automatically go to the next tab.
- .TabEnabled(1) = True
- .TabEnabled(2) = True
- .TabEnabled(3) = True
- .TabEnabled(4) = True
- End With
- OptWindow.SetFocus
- CmdNext.Enabled = True
- CmdBack.Enabled = True
- CmdAccept.Enabled = True
- CmdCancel.Caption = "Close"
- MainTab.Tab = 1
- End Sub
- Private Sub Form_Load()
- Center Me ' Centers the form onto the screen.
- MainTab.Tab = 0 ' Intialize the program with the first tab open.
- CmdBack.Enabled = False ' Disable the << Back button so that the user
- CmdNext.Enabled = False ' is not able to click and try to go back from the
- CmdAccept.Enabled = False ' first tab. The Next >> button is disabled so that the
- ' user cannot proceed without choosing a report first.
- ' The Accept button is disabled as there is nothing to
- ' accept at this point.
-
- With MainTab ' Disable all tabs other than the first tab
- .TabEnabled(1) = False ' (Open a Crystal Report) and the last tab
- .TabEnabled(2) = False ' (About Crystal Reports)
- .TabEnabled(3) = False
- End With
- FrmWin.Enabled = False ' Disable the frames that encapsulate the destination
- FrmPrinter.Enabled = False ' options for the window, printer, or file.
- FrmFile.Enabled = False
- End Sub
- Private Sub FormulaTab_Click(PreviousTab As Integer)
- If FormulaTab.Tab = 3 Then
- CmdAccptFormula.Enabled = False
- CmdClrFormula.Enabled = False
- CmdAccptFormula.Enabled = True
- CmdClrFormula.Enabled = True
- End If
- End Sub
- Private Sub MainTab_Click(PreviousTab As Integer)
- 'Dim iMainTabNum As Integer
- ' Select Case iMainTabNum
- ' Case 0
- ' Case 1
- ' Case 2
- ' Case 3
- ' TxtFormulaName.SetFocus
-
- ' Case 4
- ' Case 5
- 'End Select
-
- End Sub
- Private Sub OptCSV_Click()
- TxtPrnFileName.Text = ".csv"
- CrystalReport1.PrintFileType = 4
- TxtPrnFileName.SetFocus
- End Sub
- Private Sub OptDIF_Click()
- TxtPrnFileName.Text = ".dif"
- CrystalReport1.PrintFileType = 3
- TxtPrnFileName.SetFocus
- End Sub
- Private Sub OptFile_Click()
- CrystalReport1.Destination = 2
- FrmFile.Enabled = True
- LblFileName.Enabled = True
- OptCSV.Enabled = True
- OptDIF.Enabled = True
- OptRecord.Enabled = True
- OptTabSep.Enabled = True
- OptTabSepText.Enabled = True
- OptText.Enabled = True
- FrmFileType.Enabled = True
- PrnFileDir.Enabled = True
- PrnFileDrive.Enabled = True
- TxtWinTitle.Text = " "
- TxtPrnCopies.Text = " "
- FrmWin.Enabled = False
- LblWinTitle.Enabled = False
- FrmPrinter.Enabled = False
- LblPrnCopies.Enabled = False
- SpinButton1.Enabled = False
- SpinButton1.ForeColor = &HC0C0C0
- End Sub
- Private Sub OptPrinter_Click()
- CrystalReport1.Destination = 1
- FrmPrinter.Enabled = True
- LblPrnCopies.Enabled = True
- SpinButton1.Enabled = True
- SpinButton1.ForeColor = &H0
- TxtPrnCopies.SetFocus
- TxtWinTitle.Text = " "
- TxtPrnFileName.Text = " "
- FrmWin.Enabled = False
- LblWinTitle.Enabled = False
- FrmFile.Enabled = False
- LblFileName.Enabled = False
- OptCSV.Enabled = False
- OptDIF.Enabled = False
- OptRecord.Enabled = False
- OptTabSep.Enabled = False
- OptTabSepText.Enabled = False
- OptText.Enabled = False
- FrmFileType.Enabled = False
- PrnFileDir.Enabled = False
- PrnFileDrive.Enabled = False
- End Sub
- Private Sub OptRecord_Click()
- TxtPrnFileName.Text = ".rec"
- CrystalReport1.PrintFileType = 0
- TxtPrnFileName.SetFocus
- End Sub
- Private Sub OptTabSep_Click()
- TxtPrnFileName.Text = ".tsv"
- CrystalReport1.PrintFileType = 1
- TxtPrnFileName.SetFocus
- End Sub
- Private Sub OptTabSepText_Click()
- TxtPrnFileName.Text = ".ttx"
- CrystalReport1.PrintFileType = 6
- TxtPrnFileName.SetFocus
- End Sub
- Private Sub OptText_Click()
- TxtPrnFileName.Text = ".txt"
- CrystalReport1.PrintFileType = 2
- TxtPrnFileName.SetFocus
- End Sub
- Private Sub OptWindow_Click()
- CrystalReport1.Destination = 0
- FrmWin.Enabled = True
- LblWinTitle.Enabled = True
- TxtWinTitle.SetFocus
- TxtPrnCopies.Text = " "
- TxtPrnFileName.Text = " "
- FrmPrinter.Enabled = False
- LblPrnCopies.Enabled = False
- SpinButton1.Enabled = False
- SpinButton1.ForeColor = &HC0C0C0
- FrmFile.Enabled = False
- LblFileName.Enabled = False
- OptCSV.Enabled = False
- OptDIF.Enabled = False
- OptRecord.Enabled = False
- OptTabSep.Enabled = False
- OptTabSepText.Enabled = False
- OptText.Enabled = False
- FrmFileType.Enabled = False
- PrnFileDir.Enabled = False
- PrnFileDrive.Enabled = False
- End Sub
- Private Sub PrnFileDrive_Change()
- PrnFileDir.Path = PrnFileDrive.Drive
- End Sub
- Private Sub SpinButton1_SpinDown()
- ' Decrement the value in the text box on every SpinDown event.
- If Str$(Val(TxtPrnCopies.Text)) > 1 Then
- TxtPrnCopies.Text = Str$(Val(TxtPrnCopies.Text) - 1)
- ' Display the current value in the text box.
- TxtPrnCopies.Refresh
- Else
- TxtPrnCopies.Text = 1
-
- End If
- End Sub
- Private Sub SpinButton1_SpinUp()
- ' Increment the value in the text box on every SpinUp event.
- TxtPrnCopies.Text = Str$(Val(TxtPrnCopies.Text) + 1)
- ' Display the current value in the text box.
- TxtPrnCopies.Refresh
- End Sub
- Private Sub TxtFormulaName_Change()
- CmdAccptFormula.Enabled = True
- End Sub
- Private Sub TxtGrpSelFormula_Change()
- CmdAccptFormula.Enabled = True
- End Sub
- Private Sub TxtPrnCopies_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- KeyAscii = 0
- CrystalReport1.Action = 1
- End If
- End Sub
- Private Sub TxtPrnFileName_Change()
- Dim sPrintFile As String
- sPrintFile = PrnFileDir.Path & "\" & TxtPrnFileName.Text
- CrystalReport1.PrintFileName = sPrintFile
- End Sub
- Private Sub TxtPrnFileName_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- KeyAscii = 0
- CrystalReport1.Action = 1
- End If
- End Sub
- Private Sub TxtRecSelFormula_Change()
- CmdAccptFormula.Enabled = True
- End Sub
- Private Sub TxtUserName_Change()
- CmdSecurity.Enabled = True
- End Sub
- Private Sub TxtWinTitle_Change()
- CrystalReport1.WindowTitle = TxtWinTitle.Text
- End Sub
- Private Sub TxtWinTitle_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- CmdAccept_Click
- KeyAscii = 0
- End If
- End Sub
- Public Sub ResetIndexes()
- FormulaNum = 0
- RecSort = 0
- grpsort = 0
- End Sub
-