home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form Form1
- Caption = "Form1"
- ClientHeight = 5445
- ClientLeft = 1110
- ClientTop = 1380
- ClientWidth = 8370
- Height = 5850
- Left = 1050
- LinkTopic = "Form1"
- ScaleHeight = 5445
- ScaleWidth = 8370
- Top = 1035
- Width = 8490
- Begin CrystalReport Report1
- Connect = ""
- CopiesToPrinter = 1
- Destination = 0 'Window
- GroupSelectionFormula= ""
- Left = 7560
- PrintFileName = ""
- PrintFileType = 2 'Text
- ReportFileName = "VBXMDB.RPT"
- SelectionFormula= ""
- SessionHandle = 0
- Top = 600
- UserName = ""
- WindowBorderStyle= 2 'Sizable
- WindowControlBox= -1 'True
- WindowHeight = 300
- WindowLeft = 100
- WindowMaxButton = -1 'True
- WindowMinButton = -1 'True
- WindowParentHandle= 0
- WindowTitle = ""
- WindowTop = 100
- WindowWidth = 480
- End
- Begin TextBox RangeEnd
- Height = 285
- Left = 4080
- TabIndex = 2
- Text = " "
- Top = 3000
- Width = 1455
- End
- Begin TextBox RangeStart
- Height = 285
- Left = 4080
- TabIndex = 1
- Text = " "
- Top = 2520
- Width = 1455
- End
- Begin CommandButton Print_Report
- Caption = "Print Report"
- Height = 495
- Left = 2160
- TabIndex = 3
- Top = 3960
- Width = 3375
- End
- Begin ComboBox OutputList
- Height = 300
- Left = 2160
- TabIndex = 0
- Text = " "
- Top = 1680
- Width = 3735
- End
- Begin Label Label7
- Caption = "To:"
- Height = 255
- Left = 2880
- TabIndex = 8
- Top = 3000
- Width = 855
- End
- Begin Label Label6
- Caption = "From:"
- Height = 255
- Left = 2880
- TabIndex = 7
- Top = 2520
- Width = 735
- End
- Begin Label Label5
- Caption = "Order Number"
- Height = 255
- Left = 840
- TabIndex = 6
- Top = 2520
- Width = 1335
- End
- Begin Label Label2
- Caption = "Print Destination"
- Height = 255
- Left = 360
- TabIndex = 5
- Top = 1680
- Width = 1695
- End
- Begin Label Label1
- Caption = "Sample App using Crystal Reports Custom Control"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 13.5
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 375
- Left = 240
- TabIndex = 4
- Top = 600
- Width = 7935
- End
- Dim StrBuffer As String * 250
- Sub Form_Load ()
- OutputList.AddItem "Window"
- OutputList.AddItem "Printer"
- OutputList.AddItem "File"
- OutputList.Text = "Window"
- RangeStart.Text = "1"
- RangeEnd.Text = "9999"
- End Sub
- Sub OutputList_Click ()
- If OutputList.Text = "Printer" Then
- Form2.Show
- Else
- If OutputList.Text = "File" Then
- Form3.Show
- End If
- End If
- End Sub
- Sub Print_Report_Click ()
- ' Please note that several properties of Report1 have been set
- ' for this example. Select F4 ( Properties ) when the focus is on
- ' the Crystal Reports icon to view these properties.
- ' For Example, the ReportName property has been set
- ' to vbxmdb.rpt. This report file was included in the
- ' Reports directory.
- ' Set Report1 Destination property based on the output
- ' setting which the user has selected from the Combination
- ' box on the report entitled OutputList.
- If OutputList.Text = "Window" Then
- OutputDestination = 0
- Else
- If OutputList.Text = "Printer" Then
- OutputDestination = 1
- Report1.CopiesToPrinter = Number_Of_Copies
- Else
- If OutputList.Text = "File" Then
- OutputDestination = 2
- Report1.PrintFileName = Output_File_Name
- Report1.PrintFileType = Output_File_Type
- End If
- End If
- End If
- Report1.Destination = OutputDestination
- ' Set the Record Selection formula based on the Starting
- ' and ending ranges
- FmlaText$ = "{detail.ORDERNUM} in '" + Trim(RangeStart.Text) + "' to '" + Trim(RangeEnd.Text) + "'"
- Report1.SelectionFormula = FmlaText$
- ' Set location of the database file to the location from
- ' which the user ran the app
- LocText$ = LCase(app.Path)
- If Right$(app.Path, 1) <> "\" Then LocText$ = LocText$ + "\" 'handles the root
- Report1.DataFiles(0) = LocText$ + "crystal.mdb"
- Report1.ReportFileName = LocText$ + "vbxmdb.rpt"
- ' EXECUTE PRINT CALL
- On Error GoTo ErrorHandler
- Report1.Action = 1
- Exit Sub
- ErrorHandler:
- MsgBox Error$
- Exit Sub
- End Sub
- Sub RangeEnd_GotFocus ()
- RangeEnd.SelStart = 0
- RangeEnd.SelLength = Len(RangeEnd.Text)
- End Sub
- Sub RangeStart_GotFocus ()
- RangeStart.SelStart = 0
- RangeStart.SelLength = Len(RangeStart.Text)
- End Sub
-