home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 5445
- ClientLeft = 1110
- ClientTop = 1380
- ClientWidth = 8370
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 5850
- Left = 1050
- LinkTopic = "Form1"
- ScaleHeight = 5445
- ScaleWidth = 8370
- Top = 1035
- Width = 8490
- Begin VB.TextBox RangeEnd
- Height = 285
- Left = 4080
- Locked = -1 'True
- TabIndex = 2
- Text = " "
- Top = 3000
- Width = 1455
- End
- Begin VB.TextBox RangeStart
- Height = 285
- Left = 4080
- Locked = -1 'True
- TabIndex = 1
- Text = " "
- Top = 2520
- Width = 1455
- End
- Begin VB.CommandButton Print_Report
- Caption = "Print Report"
- Height = 495
- Left = 2160
- TabIndex = 3
- Top = 3960
- Width = 3375
- End
- Begin VB.ComboBox OutputList
- Height = 300
- Left = 2160
- TabIndex = 0
- Text = " "
- Top = 1680
- Width = 3735
- End
- Begin Crystal.CrystalReport Report1
- Left = 7560
- Top = 600
- _extentx = 741
- _extenty = 741
- _stockprops = 0
- reportfilename = ""
- destination = 0
- windowleft = 100
- windowtop = 100
- windowwidth = 490
- windowheight = 300
- windowtitle = ""
- windowborderstyle= 2
- windowcontrolbox= -1 'True
- windowmaxbutton = -1 'True
- windowminbutton = -1 'True
- copiestoprinter = 1
- printfilename = ""
- printfiletype = 0
- selectionformula= ""
- groupselectionformula= ""
- connect = ""
- username = ""
- End
- Begin VB.Label Label7
- Caption = "To:"
- Height = 255
- Left = 2880
- TabIndex = 8
- Top = 3000
- Width = 855
- End
- Begin VB.Label Label6
- Caption = "From:"
- Height = 255
- Left = 2880
- TabIndex = 7
- Top = 2520
- Width = 735
- End
- Begin VB.Label Label5
- Caption = "Order Number"
- Height = 255
- Left = 840
- TabIndex = 6
- Top = 2520
- Width = 1335
- End
- Begin VB.Label Label2
- Caption = "Print Destination"
- Height = 255
- Left = 360
- TabIndex = 5
- Top = 1680
- Width = 1695
- End
- Begin VB.Label Label1
- Caption = "Sample App using Crystal Reports Custom Control"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 13.5
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 375
- Left = 240
- TabIndex = 4
- Top = 600
- Width = 7935
- End
- Attribute VB_Name = "Form1"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Dim StrBuffer As String * 250
- Private Sub Form_Load()
- OutputList.AddItem "Window"
- OutputList.AddItem "Printer"
- OutputList.AddItem "File"
- OutputList.Text = "Window"
- RangeStart.Text = "1"
- RangeEnd.Text = "9999"
- End Sub
- Private Sub OutputList_Click()
- If OutputList.Text = "Printer" Then
- Form2.Show
- Else
- If OutputList.Text = "File" Then
- Form3.Show
- End If
- End If
- End Sub
- Private 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 ocxmdb.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$ + "ocxmdb.rpt"
- ' EXECUTE PRINT CALL
- On Error GoTo ErrorHandler
- Report1.Action = 1
- Exit Sub
- ErrorHandler:
- MsgBox Report1.LastErrorString
- Exit Sub
- End Sub
- Private Sub RangeEnd_GotFocus()
- RangeEnd.SelStart = 0
- RangeEnd.SelLength = Len(RangeEnd.Text)
- End Sub
- Private Sub RangeStart_GotFocus()
- RangeStart.SelStart = 0
- RangeStart.SelLength = Len(RangeStart.Text)
- End Sub
-