home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / vbxdemo / setformu.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-12-15  |  9.2 KB  |  257 lines

  1. VERSION 2.00
  2. Begin Form SetFormula 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Formulas"
  5.    ClientHeight    =   6675
  6.    ClientLeft      =   960
  7.    ClientTop       =   1695
  8.    ClientWidth     =   9660
  9.    Height          =   7365
  10.    Left            =   900
  11.    LinkTopic       =   "Form3"
  12.    ScaleHeight     =   7820.709
  13.    ScaleMode       =   0  'User
  14.    ScaleWidth      =   9660
  15.    Top             =   1065
  16.    Width           =   9780
  17.    Begin CommandButton Command9 
  18.       Caption         =   "Help"
  19.       Height          =   375
  20.       Left            =   7830
  21.       TabIndex        =   11
  22.       Top             =   1260
  23.       Width           =   1455
  24.    End
  25.    Begin CommandButton Command8 
  26.       Caption         =   "Ok"
  27.       Height          =   375
  28.       Left            =   7830
  29.       TabIndex        =   8
  30.       Top             =   360
  31.       Width           =   1455
  32.    End
  33.    Begin SSFrame Frame3D2 
  34.       Caption         =   "Group Selection Formula"
  35.       Font3D          =   0  'None
  36.       ForeColor       =   &H00000000&
  37.       Height          =   2085
  38.       Left            =   330
  39.       TabIndex        =   13
  40.       Top             =   4410
  41.       Width           =   7215
  42.       Begin TextBox GroupSelectText 
  43.          Height          =   1275
  44.          Left            =   1500
  45.          MultiLine       =   -1  'True
  46.          ScrollBars      =   2  'Vertical
  47.          TabIndex        =   6
  48.          Top             =   300
  49.          Width           =   5595
  50.       End
  51.       Begin CommandButton Command4 
  52.          Caption         =   "Set"
  53.          Height          =   375
  54.          Left            =   210
  55.          TabIndex        =   7
  56.          Top             =   330
  57.          Width           =   1005
  58.       End
  59.       Begin Label Label2 
  60.          BackColor       =   &H00C0C0C0&
  61.          Caption         =   "Example: Sum({header.AMOUNT},{company.CUSTNUM}) = 2,053"
  62.          Height          =   285
  63.          Left            =   1500
  64.          TabIndex        =   17
  65.          Top             =   1710
  66.          Width           =   5625
  67.       End
  68.    End
  69.    Begin SSFrame Frame3D1 
  70.       Caption         =   "Selection Formula"
  71.       Font3D          =   0  'None
  72.       ForeColor       =   &H00000000&
  73.       Height          =   2010
  74.       Left            =   330
  75.       TabIndex        =   12
  76.       Top             =   2280
  77.       Width           =   7215
  78.       Begin CommandButton Command1 
  79.          Caption         =   "Set"
  80.          Height          =   375
  81.          Left            =   210
  82.          TabIndex        =   5
  83.          Top             =   330
  84.          Width           =   1005
  85.       End
  86.       Begin TextBox SelectText 
  87.          Height          =   1230
  88.          Left            =   1470
  89.          MultiLine       =   -1  'True
  90.          ScrollBars      =   2  'Vertical
  91.          TabIndex        =   4
  92.          Top             =   300
  93.          Width           =   5595
  94.       End
  95.       Begin Label Label1 
  96.          BackColor       =   &H00C0C0C0&
  97.          Caption         =   "Example: {company.LASTYRSALE} > 19,000.00"
  98.          Height          =   225
  99.          Left            =   1470
  100.          TabIndex        =   16
  101.          Top             =   1620
  102.          Width           =   5625
  103.       End
  104.    End
  105.    Begin SSFrame Formulas 
  106.       Caption         =   "Formulas"
  107.       Font3D          =   0  'None
  108.       ForeColor       =   &H00000000&
  109.       Height          =   2025
  110.       Left            =   330
  111.       TabIndex        =   9
  112.       Top             =   120
  113.       Width           =   7215
  114.       Begin TextBox FormNumText 
  115.          Height          =   315
  116.          Left            =   5490
  117.          TabIndex        =   1
  118.          Text            =   "0"
  119.          Top             =   360
  120.          Width           =   1215
  121.       End
  122.       Begin TextBox FormulaName 
  123.          Height          =   315
  124.          Left            =   1440
  125.          TabIndex        =   0
  126.          Top             =   360
  127.          Width           =   2325
  128.       End
  129.       Begin CommandButton Command7 
  130.          Caption         =   "Set"
  131.          Height          =   375
  132.          Left            =   240
  133.          TabIndex        =   3
  134.          Top             =   840
  135.          Width           =   975
  136.       End
  137.       Begin TextBox FormulaText 
  138.          Height          =   1080
  139.          Left            =   1440
  140.          MultiLine       =   -1  'True
  141.          ScrollBars      =   2  'Vertical
  142.          TabIndex        =   2
  143.          Top             =   810
  144.          Width           =   5625
  145.       End
  146.       Begin Label ForNumLabel 
  147.          BackColor       =   &H00C0C0C0&
  148.          Caption         =   "Formula Number"
  149.          Height          =   255
  150.          Left            =   3930
  151.          TabIndex        =   15
  152.          Top             =   390
  153.          Width           =   1455
  154.       End
  155.       Begin Label FormulaNLabel 
  156.          BackColor       =   &H00C0C0C0&
  157.          Caption         =   "Formula Name"
  158.          Height          =   255
  159.          Left            =   180
  160.          TabIndex        =   14
  161.          Top             =   360
  162.          Width           =   1275
  163.       End
  164.    End
  165.    Begin CommandButton Command2 
  166.       Caption         =   "Close"
  167.       Height          =   375
  168.       Left            =   7830
  169.       TabIndex        =   10
  170.       Top             =   810
  171.       Width           =   1455
  172.    End
  173.    Begin Menu MenuFile 
  174.       Caption         =   "&File"
  175.       Begin Menu MenuFileExit 
  176.          Caption         =   "&Exit"
  177.       End
  178.    End
  179. Sub Command1_Click ()
  180. 'Set the Selection formula. If you already have a selection formula
  181. 'in Crystal report then the one that you pass from this
  182. 'application will append to the existing selection criteria with
  183. 'an AND statement. Therefore, a situation may arise when you print a report
  184. 'and no record appear on the screen. This could be do to multiple selection statements.
  185. 'The best solution is to pass all of the selection criteria from VB to avoid this
  186. 'type of situation.
  187. 'Store Selection Statement into a temporary variable
  188.   FmlSelect$ = SelectText.Text
  189. 'Set the Selection formula based on Fmlselect$. If you are not using the text box format to pass
  190. 'your selection criteria then a great debugging method that works perfectly is to store your
  191. 'selection string in a temporary variable as shown above. Then MsgBox this variable prior to
  192. 'actually setting the selection criteria. The result of the MsgBox should look exactly like
  193. 'the selection criteria if you were to build it in Crystal Reports itself.
  194.   Main.Report1.SelectionFormula = FmlSelect$
  195.   Main!StatusBar.Caption = FmlSelect$
  196. End Sub
  197. Sub Command2_Click ()
  198.  Unload Me
  199. End Sub
  200. Sub Command3_Click ()
  201. End Sub
  202. Sub Command4_Click ()
  203. 'Set the Group Selection formula. If you already have a selection formula
  204. 'in Crystal report then the one that you pass from this
  205. 'application will append to the existing selection criteria with
  206. 'an AND statement. Therefore, a situation may arise when you print a report
  207. 'and no records appear on the screen. This could be do to multiple selection statements.
  208. 'The best solution is to pass all of the selection criteria from VB to avoid this
  209. 'type of situation.
  210. 'Store Group Selection Statement into a temporary variable
  211.   GrpSelect$ = GroupSelectText.Text
  212. 'Set the Selection formula based on Fmlselect$. If you are not using the text box format to pass
  213. 'your selection criteria then a great debugging method that works perfectly is to store your
  214. 'selection string in a temporary variable as shown above. Then MsgBox this variable prior to
  215. 'actually setting the selection criteria. The result of the MsgBox should look exactly like
  216. 'the selection criteria if you were to build it in Crystal Reports itself.
  217.   Main.Report1.GroupSelectionFormula = GrpSelect$
  218.   Main!StatusBar.Caption = GrpSelect$
  219. End Sub
  220. Sub Command5_Click ()
  221. End Sub
  222. Sub Command6_Click ()
  223. End Sub
  224. Sub Command7_Click ()
  225. 'Set formula to pass to crystal Reports
  226. 'the formula name does not have quotes surrounding it and does not include
  227. 'the @ sign as shown in Crystal Reports
  228. 'If you have a formula in Crystal called @Test then the formula
  229. 'name that would be inputted in the text box would just be
  230. 'Test
  231. 'The actual formula text should be typed in exactly as you would
  232. 'do in Crystal Reports. For Example, {file.field} * 1200. You must
  233. 'place all brackets, filenames, fieldnames, operators etc.
  234. 'Store Formula string in a temp variable
  235.    FmlaText$ = FormulaName.Text & "=" & FormulaText.Text
  236. 'Set Formula based on FmlaText$. Notice that the index in formulas
  237. 'refers to the FormNumText text property. The user must specify
  238. 'The appropriate formula number. The first formula set would be 0
  239. 'the second would be 1 etc.
  240.    Main.Report1.Formulas(FormNumText.Text) = FmlaText$
  241. 'Display the formula string being passed in the statusbar
  242. 'to help in debugging code
  243.    Main!StatusBar.Caption = FmlaText$
  244. End Sub
  245. Sub Command8_Click ()
  246. Unload Me
  247. End Sub
  248. Sub Command9_Click ()
  249.  RCode = Shell("Winhelp c:\crw\crw.hlp", 3)
  250.  If RCode = False Then
  251.    MsgBox ("CRWDEMO cannot find the Crystal Help file in C:\CRW directory")
  252.  End If
  253. End Sub
  254. Sub MenuFileExit_Click ()
  255.  Unload Me
  256. End Sub
  257.