home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / crystal / extras / ocx45_32 / crw45ocx.bas next >
Encoding:
BASIC Source File  |  1995-08-28  |  28.5 KB  |  874 lines

  1. Attribute VB_Name = "ocx45"
  2. Option Explicit
  3. Global ReportSection As String
  4. Global GroupCondition As String
  5. Global PrnFileName As String
  6. ' Function Parameters
  7. ' MsgBox parameters
  8. Global Const MB_OK = 0                 ' OK button only
  9. Global Const MB_ICONSTOP = 16          ' Critical message
  10. Global Const MB_APPLMODAL = 0          ' Application Modal Message Box
  11. Global Const MB_DEFBUTTON1 = 0         ' First button is default
  12. Global Const MB_DEFBUTTON2 = 256       ' Second button is default
  13. Global Const MB_DEFBUTTON3 = 512       ' Third button is default
  14. Global Const MB_SYSTEMMODAL = 4096      'System Modal
  15.  
  16. ' MsgBox return values
  17. Global Const IDOK = 1                  ' OK button pressed
  18. Global Const IDCANCEL = 2              ' Cancel button pressed
  19. Global Const IDABORT = 3               ' Abort button pressed
  20. Global Const IDRETRY = 4               ' Retry button pressed
  21. Global Const IDIGNORE = 5              ' Ignore button pressed
  22. Global Const IDYES = 6                 ' Yes button pressed
  23. Global Const IDNO = 7                  ' No button pressed
  24.  
  25.  
  26. Sub PrintError(iPrintErrorNum As Integer)
  27.  
  28. ' This procedure is designed to trap Crystal Report error codes and present
  29. ' the user with a choice of how they wish to proceed once recieving the error.
  30. ' This is to avoid Visual Basic from exiting the application when one of these
  31. ' errors are encountered.
  32.  
  33.  
  34. Const Title = "OCXDEMO Error"
  35. Dim sMsg As String
  36. Dim iResponse, sMsgDesc As Integer
  37.  
  38. sMsgDesc = MB_OK + MB_ICONSTOP + MB_DEFBUTTON1 + MB_APPLMODAL
  39. Select Case iPrintErrorNum
  40.  
  41. Case 500    'PE_ERR_NOTENOUGHMEMORY
  42.         sMsg = "There is not enough memory available to complete the call."
  43.         sMsg = sMsg & "Please Close other Applications down and try again."
  44.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  45.  
  46.  
  47. Case 501    'PE_ERR_INVALIDJOBNO
  48.         sMsg = "You have specified a job number that does not exist."
  49.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  50.  
  51.  
  52. Case 502    'PE_ERR_INVALIDHANDLE
  53.         sMsg = "You have specified a handle that does not exist."
  54.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  55.  
  56.  
  57. Case 503    'PE_ERR_STRINGTOOLONG
  58.         sMsg = "The string you are calling with PEGetHandleString is too long for the buffer "
  59.         sMsg = sMsg & "allocated. If returned by other routines, it means that the string doesn't end "
  60.         sMsg = sMsg & "with a null byte."
  61.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  62.  
  63. Case 504    'PE_ERR_NOSUCHREPORT
  64.         sMsg = "You have specified a report that does not exist in the path."
  65.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  66.  
  67.  
  68. Case 505    'PE_ERR_NODESTINATION
  69.         sMsg = "You have made the PEStartPrintJob call without "
  70.         sMsg = sMsg & "first specifying a print destination."
  71.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  72.  
  73.  
  74. Case 506    'PE_ERR_BADFILENUMBER
  75.         sMsg = "You have tried to set an Nth file name and the file number you specified is "
  76.         sMsg = "out of the existing range. 0<= fileN < N files."
  77.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  78.  
  79.  
  80. Case 507    'PE_ERR_BADFILENAME
  81.         sMsg = "There is an error in the file name you specified.  Pease make sure that the "
  82.         sMsg = sMsg & "path and report filename are correct"
  83.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  84.  
  85.  
  86. Case 508    'PE_ERR_BADFIELDNUMBER
  87.         sMsg = "The field number you specified is out of the existing range."
  88.         sMsg = sMsg & "0 <= fieldN <= N fields."
  89.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  90.  
  91.  
  92. Case 509    'PE_ERR_BADFIELDNAME
  93.         sMsg = "The program can't add the field name you specified."
  94.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  95.  
  96.  
  97. Case 510    'PE_ERR_BADFORMULANAME
  98.         sMsg = "The program can't add the formula name you specified."
  99.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  100.  
  101.  
  102. Case 511    'PE_ERR_BADSORTDIRECTION
  103.         sMsg = "Sort direction must be either Descending or Ascending. You have "
  104.         sMsg = sMsg & "specified a sort direction other than those allowed."
  105.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  106.  
  107.  
  108. Case 512    'PE_ERR_ENGINENOTOPEN
  109.         sMsg = "The print engine must be open in order for the call to be successful. Your "
  110.         sMsg = sMsg & "code is lacking a PEOpenEngine call."
  111.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  112.  
  113.  
  114. Case 513    'PE_ERR_INVALIDPRINTER
  115.         sMsg = "The printer driver for the printer you specified is missing."
  116.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  117.  
  118.  
  119. Case 514    'PE_ERR_PRINTFILEEXISTS
  120.         sMsg = "The name you have specified for the export file already exists. You must delete "
  121.         sMsg = sMsg & "the file and export again or specify a different file."
  122.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  123.  
  124.  
  125. Case 515    'PE_ERR_BADFORMULATEXT
  126.         sMsg = "There seems to be a syntax error in a formula being passed to the "
  127.         sMsg = sMsg & "report. Please return to the formula and check the syntax."
  128.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  129.  
  130.  
  131.  
  132. Case 516    'PE_ERR_BADGROUPSECTION
  133.         sMsg = "The group section you specified is now invalid in the report, i.e., a group is "
  134.         sMsg = sMsg & "based on a formula field and the formula has changed so it's no longer suitable "
  135.         sMsg = sMsg & "for basing a group on."
  136.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  137.  
  138.  
  139. Case 517    'PE_ERR_ENGINEBUSY
  140.         sMsg = "Only one application can access the print engine at one time. There is "
  141.         sMsg = sMsg & "currently another app using the engine."
  142.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  143.  
  144.  
  145. Case 518    'PE_ERR_BADSECTION
  146.         sMsg = "You've given a bad value as the section code for some function like "
  147.         sMsg = sMsg & "PESetGroupCondition."
  148.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  149.  
  150.  
  151. Case 519    'PE_ERR_NOPRINTWINDOW
  152.         sMsg = "There is no print window available to make your call successful (for any call "
  153.         sMsg = sMsg & "that depends on a print window already existing: PEGetWindowHandle, "
  154.         sMsg = sMsg & "PECloseWindow, PEPrintWindow)."
  155.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  156.  
  157. Case 520    'PE_ERR_JOBALREADYSTARTED
  158.         sMsg = "You are trying to start a print job that has already been started. This can "
  159.         sMsg = sMsg & "happen if the user starts a print job and then tries to start printing again "
  160.         sMsg = sMsg & "before the previous printing has finished."
  161.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  162.  
  163.  
  164. Case 521    'PE_ERR_BADSUMMARYFIELD
  165.         sMsg = "The summary field specified as a group sort field is invalid or non-existent."
  166.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  167.  
  168.  
  169. Case 522    'PE_ERR_NOTENOUGHSYSRES
  170.         sMsg = "There are not enough Windows system resources to process the function."
  171.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  172.  
  173.  
  174. Case 523    'PE_ERR_BADGROUPCONDITION
  175.         sMsg = "You have specified an invalid group condition."
  176.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  177.  
  178.  
  179. Case 524    'PE_ERR_JOBBUSY
  180.         sMsg = "You tried to initiate printing while Crystal Reports is already printing a job."
  181.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  182.  
  183.  
  184. Case 525    'PE_ERR_BADREPORTFILE
  185.         sMsg = "There is something wrong with the report you are trying to open."
  186.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  187.  
  188.  
  189. Case 526    'PE_ERR_NODEFAULTPRINTER
  190.         sMsg = "You haven't specified a default printer. Specify a default printer "
  191.         sMsg = sMsg & "via the Windows Control Panel."
  192.         iResponse = MsgBox(sMsg, sMsgDesc, Title)
  193.  
  194. Case 527    'PE_ERR_SQLSQLSERVERERROR
  195.     sMsg = "Unable to connect to the Server.  Some of the most common reasons for the error to occur are: "
  196.     sMsg = sMsg & "Database Driver DLLs cannot be found. "
  197.     sMsg = sMsg & "LogonInfo Parameters are not NULL terminated. "
  198.     sMsg = sMsg & "Incorrect Logon Parameters.  Ensure that the ServerName, DatabaseName and UserId and Password "
  199.     sMsg = sMsg & "are all valid for the server that you are trying to logon to."
  200.     sMsg = sMsg & "Incorrect StructSize given for LogonInfo Structure.  If an incorrect value is given here, a "
  201.     sMsg = sMsg & "SQL Server error may result.  The correct value for the StructSize is 514. "
  202.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  203.  
  204.  
  205. Case 528    'PE_ERR_BADLINENUMBER
  206.     sMsg = "You have specified an invalid line number."
  207.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  208.     
  209.  
  210.  
  211. Case 529    'PE_ERR_DISKFULL
  212.     sMsg = "When printing to file or when sorting, the program requires more room than is "
  213.     sMsg = sMsg & "available on the disk."
  214.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  215.  
  216.  
  217.  
  218. Case 530    'PE_ERR_FILEERROR
  219.     sMsg = "In trying to print to file, the program is encountering another file "
  220.     sMsg = sMsg & "problem besides disk full."
  221.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  222.  
  223.  
  224.  
  225. Case 531    'PE_ERR_INCORRECTPASSWORD
  226.     sMsg = "You have specified an incorrect password."
  227.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  228.  
  229.  
  230.  
  231. Case 532    'PE_ERR_BADDATABASEDLL
  232.     sMsg = "The database DLL is corrupt.Add DeBugMode=Yes to the CRW.INI file "
  233.     sMsg = sMsg & "found in the \Windows\ directory so that a better error message "
  234.     sMsg = sMsg & "will be returned."
  235.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  236.  
  237.  
  238.  
  239. Case 533    'PE_ERR_BADDATABASEFILE
  240.     sMsg = "Something is wrong with the database you have specified. You may need to verify "
  241.     sMsg = sMsg & "using the Database|Verify Database command."
  242.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  243.     
  244.  
  245.  
  246. Case 534    'PE_ERR_ERRORINDATABASEDLL
  247.     sMsg = "The database DLL is corrupt. Add DeBugMode=Yes to the CRW.INI file "
  248.     sMsg = sMsg & "found in the \Windows\ directory so that a better error message "
  249.     sMsg = sMsg & "will be returned."
  250.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  251.  
  252.  
  253. Case 535    'PE_ERR_DATABASESESSION
  254.     sMsg = "You have attempted to log on using incomplete or incorrect session parameters."
  255.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  256.  
  257.  
  258.  
  259. Case 536    'PE_ERR_DATABASELOGON
  260.     sMsg = "You have attempted to log on using incomplete or incorrect log on parameters."
  261.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  262.  
  263. Case 537    'PE_ERR_DATABASELOCATION
  264.     sMsg = "The table you have specified can not be found."
  265.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  266.  
  267. Case 538    'PE_ERR_BADSTRUCTSIZE
  268.     sMsg = "Internal error."
  269.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  270.  
  271. Case 539    'PE_ERR_BADDATE
  272.     sMsg = "You have specified an Invalid date using the PESetPrintDate command."
  273.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  274.  
  275. Case 540    'PE_ERR_BADEXPORTDLL
  276.     sMsg = "The DLL required by your export call is either missing or out-of-date."
  277.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  278.  
  279. Case 541    'PE_ERR_ERRORINEXPORTDLL
  280.     sMsg = "An export DLL has reported an error."
  281.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  282.  
  283.  
  284. Case 542    'PE_ERR_PREVATFIRSTPAGE
  285.     sMsg = "You're using the previous page control in the Preview window when "
  286.     sMsg = sMsg & "You are already at the first page of the report."
  287.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  288.  
  289. Case 543    'PE_ERR_NEXTATLASTPAGE
  290.     sMsg = "You are using the next page control in the Preview window when you're "
  291.     sMsg = sMsg & "already at the last page of the report."
  292.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  293.  
  294. Case 544    'PE_ERR_CANNOTACCESSREPORT
  295.     sMsg = "Access to report file denied. Another program or user may be using it. "
  296.     sMsg = sMsg & "If an OLE-based reportis already open in CRW and you're trying to "
  297.     sMsg = sMsg & "open it via CRPE, the call will fail."
  298.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  299.  
  300. Case 546    'PE_ERR_OLE2NOTLOADED
  301.     sMsg = "The program can't open the report (which includes an OLE 2.0 object) because "
  302.     sMsg = sMsg & "OLE 2.0 cannot be loaded."
  303.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  304.  
  305. Case 547    'PE_ERR_BADCROSSTABGROUP
  306.     sMsg = "You have specified an invalid row or column field in your cross-tab report."
  307.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  308.  
  309.  
  310. Case 548    'PE_ERR_NOCTSUMMARIZEDFIELD
  311.     sMsg = "You are trying to run a cross-tab report without specifying a summarized field."
  312.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  313.  
  314. Case 550    'PE_ERR_INVALIDPAGENUMBER
  315.     sMsg = "You have used an invalid page number with PEShowNthPage."
  316.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  317.  
  318.  
  319.  
  320. Case 552    'PE_ERR_NOTSTOREDPROCEDURE
  321.     sMsg = "Returned by PESetNthParam when there is no table in the current report "
  322.     sMsg = sMsg & "that is based on a stored procedure."
  323.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  324.  
  325.  
  326.  
  327. Case 553    'PE_ERR_INVALIDPARAMETER
  328.     sMsg = "The parameter you have specified does not exist in the stored procedure, "
  329.     sMsg = sMsg & "or the value you have entered is not valid for the specified parameter."
  330.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  331.  
  332.  
  333.  
  334. Case 554    'PE_ERR_GRAPHNOTFOUND
  335.     sMsg = "The graph specified for the section does not exist."
  336.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  337.  
  338.  
  339.  
  340. Case 555    'PE_ERR_INVALIDGRAPHTYPE
  341.     sMsg = "The graph type you have indicated with PESetGraphType is not valid."
  342.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  343.  
  344.  
  345.  
  346. Case 556    'PE_ERR_INVALIDGRAPHDATA
  347.     sMsg = "Returned by PESetGraphData if: "
  348.     sMsg = sMsg & "the report is a crosstab, and colGroupN or rowGroupN is > 1, or "
  349.     sMsg = sMsg & "the report is not a crosstab, and rowGroupN is something other than "
  350.     sMsg = sMsg & "PE_GRAPH_DATA_NULL_SELECTION or colGroupN+1."
  351.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  352.  
  353.  
  354. Case 557    'PE_ERR_CANNOTMOVEGRAPH
  355.     sMsg = "Returned by PESetGraphData if the report is not a crosstab, and colGroupN "
  356.     sMsg = sMsg & "differs from the graphs current value for colGroupN."
  357.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  358.  
  359. Case 577
  360.     sMsg = "DOS error"
  361.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  362.  
  363. Case 578
  364.     sMsg = "Invalid DOS version"
  365.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  366.  
  367.  
  368. Case 579
  369.     sMsg = "File already exists"
  370.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  371.  
  372. Case 580
  373.     sMsg = "File not found"
  374.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  375.  
  376. Case 581
  377.     sMsg = "Access denied"
  378.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  379.  
  380. Case 582
  381.     sMsg = "Too many open files"
  382.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  383.  
  384. Case 583
  385.     sMsg = "Invalid file handle"
  386.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  387.  
  388. Case 584
  389.     sMsg = "End of file reached"
  390.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  391.     
  392. Case 585
  393.     sMsg = "Invalid seek address"
  394.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  395.  
  396. Case 586
  397.     sMsg = "Disk full"
  398.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  399.  
  400. Case 587
  401.     sMsg = "Not enough memory"
  402.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  403.  
  404. Case 588
  405.     sMsg = "Invalid TLV record"
  406.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  407.     
  408. Case 589
  409.     sMsg = "No more files"
  410.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  411.  
  412. Case 590
  413.     sMsg = "OLE 2.0 cannot be loaded"
  414.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  415.  
  416.  
  417. Case 20999    'PE_ERR_NOTIMPLEMENTED
  418.     sMsg = "Internal error. Make sure that you have not loaded an older control, or CRPE.DLL "
  419.     sMsg = sMsg & "than is required for the version of Crystal Reports that the report was "
  420.     sMsg = sMsg & "created in.  This error message usually occurs when a Print Engine call or "
  421.     sMsg = sMsg & "control property is set and the CRPE.DLL does not support this call."
  422.     iResponse = MsgBox(sMsg, sMsgDesc, Title)
  423.  
  424. End Select
  425.  
  426. 'NOTE:  DDE Error codes from Version 1.0 of the print engine are listed in the CRPE.H file.
  427.  
  428.  
  429. End Sub
  430.  
  431.  
  432. Public Sub Center(AnyForm As Form)
  433.     AnyForm.Left = (Screen.Width - AnyForm.Width) / 2
  434.     AnyForm.Top = (Screen.Height - AnyForm.Height) / 2
  435.     
  436. End Sub
  437.  
  438.  
  439.  
  440.  
  441.  
  442. Public Sub FileType(FormatNum As Integer)
  443.  
  444. Dim iFileType As Integer
  445.  
  446. iFileType = Demo.CboPrnFileType(FormatNum).ListIndex
  447.  
  448. Select Case iFileType
  449.  
  450. Case 0
  451.     Demo.CrystalReport1.PrintFileType = 0  '
  452.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".REC"
  453.     Demo.ChkNumFormat(FormatNum).Enabled = True
  454.     Demo.ChkDateFormat(FormatNum).Enabled = True
  455.     Demo.LblSep(FormatNum).Enabled = False
  456.     Demo.LblQuote(FormatNum).Enabled = False
  457.     Demo.TxtSep(FormatNum).Enabled = False
  458.     Demo.TxtQuote(FormatNum).Enabled = False
  459.     
  460. Case 1
  461.     Demo.CrystalReport1.PrintFileType = 1   '
  462.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".TSV"
  463.     Demo.ChkNumFormat(FormatNum).Enabled = True
  464.     Demo.ChkDateFormat(FormatNum).Enabled = True
  465.     Demo.LblSep(FormatNum).Enabled = False
  466.     Demo.LblQuote(FormatNum).Enabled = False
  467.     Demo.TxtSep(FormatNum).Enabled = False
  468.     Demo.TxtQuote(FormatNum).Enabled = False
  469.     
  470. Case 2
  471.     Demo.CrystalReport1.PrintFileType = 2
  472.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".TXT"
  473.     Demo.ChkNumFormat(FormatNum).Enabled = False
  474.     Demo.ChkDateFormat(FormatNum).Enabled = False
  475.     Demo.LblSep(FormatNum).Enabled = False
  476.     Demo.LblQuote(FormatNum).Enabled = False
  477.     Demo.TxtSep(FormatNum).Enabled = False
  478.     Demo.TxtQuote(FormatNum).Enabled = False
  479.     
  480. Case 3
  481.     Demo.CrystalReport1.PrintFileType = 3
  482.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".DIF"
  483.     Demo.ChkNumFormat(FormatNum).Enabled = True
  484.     Demo.ChkDateFormat(FormatNum).Enabled = True
  485.     Demo.LblSep(FormatNum).Enabled = False
  486.     Demo.LblQuote(FormatNum).Enabled = False
  487.     Demo.TxtSep(FormatNum).Enabled = False
  488.     Demo.TxtQuote(FormatNum).Enabled = False
  489.     
  490. Case 4
  491.     Demo.CrystalReport1.PrintFileType = 4   '
  492.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".CSV"
  493.     Demo.ChkNumFormat(FormatNum).Enabled = True
  494.     Demo.ChkDateFormat(FormatNum).Enabled = True
  495.     Demo.LblSep(FormatNum).Enabled = False
  496.     Demo.LblQuote(FormatNum).Enabled = False
  497.     Demo.TxtSep(FormatNum).Enabled = False
  498.     Demo.TxtQuote(FormatNum).Enabled = False
  499.     
  500. Case 5
  501.     Demo.CrystalReport1.PrintFileType = 5    '
  502.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".CHR"
  503.     Demo.ChkNumFormat(FormatNum).Enabled = True
  504.     Demo.ChkDateFormat(FormatNum).Enabled = True
  505.     Demo.LblSep(FormatNum).Enabled = True
  506.     Demo.LblQuote(FormatNum).Enabled = True
  507.     Demo.TxtSep(FormatNum).Enabled = True
  508.     Demo.TxtQuote(FormatNum).Enabled = True
  509.     
  510. Case 6
  511.     Demo.CrystalReport1.PrintFileType = 6
  512.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".TTX"
  513.     Demo.ChkNumFormat(FormatNum).Enabled = False
  514.     Demo.ChkDateFormat(FormatNum).Enabled = False
  515.     Demo.LblSep(FormatNum).Enabled = False
  516.     Demo.LblQuote(FormatNum).Enabled = False
  517.     Demo.TxtSep(FormatNum).Enabled = False
  518.     Demo.TxtQuote(FormatNum).Enabled = False
  519.     
  520. Case 7
  521.     Demo.CrystalReport1.PrintFileType = 7
  522.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".RPT"
  523.     Demo.ChkNumFormat(FormatNum).Enabled = False
  524.     Demo.ChkDateFormat(FormatNum).Enabled = False
  525.     Demo.LblSep(FormatNum).Enabled = False
  526.     Demo.LblQuote(FormatNum).Enabled = False
  527.     Demo.TxtSep(FormatNum).Enabled = False
  528.     Demo.TxtQuote(FormatNum).Enabled = False
  529.     
  530. Case 8
  531.     Demo.CrystalReport1.PrintFileType = 8
  532.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".XLS"
  533.     Demo.ChkNumFormat(FormatNum).Enabled = False
  534.     Demo.ChkDateFormat(FormatNum).Enabled = False
  535.     Demo.LblSep(FormatNum).Enabled = False
  536.     Demo.LblQuote(FormatNum).Enabled = False
  537.     Demo.TxtSep(FormatNum).Enabled = False
  538.     Demo.TxtQuote(FormatNum).Enabled = False
  539.     
  540. Case 9
  541.     Demo.CrystalReport1.PrintFileType = 9
  542.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".XLS"
  543.     Demo.ChkNumFormat(FormatNum).Enabled = False
  544.     Demo.ChkDateFormat(FormatNum).Enabled = False
  545.     Demo.LblSep(FormatNum).Enabled = False
  546.     Demo.LblQuote(FormatNum).Enabled = False
  547.     Demo.TxtSep(FormatNum).Enabled = False
  548.     Demo.TxtQuote(FormatNum).Enabled = False
  549.     
  550. Case 10
  551.     Demo.CrystalReport1.PrintFileType = 10
  552.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".XLS"
  553.     Demo.ChkNumFormat(FormatNum).Enabled = False
  554.     Demo.ChkDateFormat(FormatNum).Enabled = False
  555.     Demo.LblSep(FormatNum).Enabled = False
  556.     Demo.LblQuote(FormatNum).Enabled = False
  557.     Demo.TxtSep(FormatNum).Enabled = False
  558.     Demo.TxtQuote(FormatNum).Enabled = False
  559.     
  560. Case 11
  561.     Demo.CrystalReport1.PrintFileType = 19
  562.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".XLS"
  563.     Demo.ChkNumFormat(FormatNum).Enabled = False
  564.     Demo.ChkDateFormat(FormatNum).Enabled = False
  565.     Demo.LblSep(FormatNum).Enabled = False
  566.     Demo.LblQuote(FormatNum).Enabled = False
  567.     Demo.TxtSep(FormatNum).Enabled = False
  568.     Demo.TxtQuote(FormatNum).Enabled = False
  569.     
  570. Case 12
  571.     Demo.CrystalReport1.PrintFileType = 11
  572.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".WK1"
  573.     Demo.ChkNumFormat(FormatNum).Enabled = False
  574.     Demo.ChkDateFormat(FormatNum).Enabled = False
  575.     Demo.LblSep(FormatNum).Enabled = False
  576.     Demo.LblQuote(FormatNum).Enabled = False
  577.     Demo.TxtSep(FormatNum).Enabled = False
  578.     Demo.TxtQuote(FormatNum).Enabled = False
  579.     
  580. Case 13
  581.     Demo.CrystalReport1.PrintFileType = 12
  582.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".WK3"
  583.     Demo.ChkNumFormat(FormatNum).Enabled = False
  584.     Demo.ChkDateFormat(FormatNum).Enabled = False
  585.     Demo.LblSep(FormatNum).Enabled = False
  586.     Demo.LblQuote(FormatNum).Enabled = False
  587.     Demo.TxtSep(FormatNum).Enabled = False
  588.     Demo.TxtQuote(FormatNum).Enabled = False
  589.     
  590. Case 14
  591.     Demo.CrystalReport1.PrintFileType = 13
  592.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".WKS"
  593.     Demo.ChkNumFormat(FormatNum).Enabled = False
  594.     Demo.ChkDateFormat(FormatNum).Enabled = False
  595.     Demo.LblSep(FormatNum).Enabled = False
  596.     Demo.LblQuote(FormatNum).Enabled = False
  597.     Demo.TxtSep(FormatNum).Enabled = False
  598.     Demo.TxtQuote(FormatNum).Enabled = False
  599.     
  600. Case 15
  601.     Demo.CrystalReport1.PrintFileType = 14
  602.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".WB1"
  603.     Demo.ChkNumFormat(FormatNum).Enabled = False
  604.     Demo.ChkDateFormat(FormatNum).Enabled = False
  605.     Demo.LblSep(FormatNum).Enabled = False
  606.     Demo.LblQuote(FormatNum).Enabled = False
  607.     Demo.TxtSep(FormatNum).Enabled = False
  608.     Demo.TxtQuote(FormatNum).Enabled = False
  609.     
  610. Case 16
  611.     Demo.CrystalReport1.PrintFileType = 15
  612.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".RTF"
  613.     Demo.ChkNumFormat(FormatNum).Enabled = False
  614.     Demo.ChkDateFormat(FormatNum).Enabled = False
  615.     Demo.LblSep(FormatNum).Enabled = False
  616.     Demo.LblQuote(FormatNum).Enabled = False
  617.     Demo.TxtSep(FormatNum).Enabled = False
  618.     Demo.TxtQuote(FormatNum).Enabled = False
  619.     
  620. Case 17
  621.     Demo.CrystalReport1.PrintFileType = 16
  622.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".DOC"
  623.     Demo.ChkNumFormat(FormatNum).Enabled = False
  624.     Demo.ChkDateFormat(FormatNum).Enabled = False
  625.     Demo.LblSep(FormatNum).Enabled = False
  626.     Demo.LblQuote(FormatNum).Enabled = False
  627.     Demo.TxtSep(FormatNum).Enabled = False
  628.     Demo.TxtQuote(FormatNum).Enabled = False
  629.     
  630. Case 18
  631.     Demo.CrystalReport1.PrintFileType = 17
  632.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".DOC"
  633.     Demo.ChkNumFormat(FormatNum).Enabled = False
  634.     Demo.ChkDateFormat(FormatNum).Enabled = False
  635.     Demo.LblSep(FormatNum).Enabled = False
  636.     Demo.LblQuote(FormatNum).Enabled = False
  637.     Demo.TxtSep(FormatNum).Enabled = False
  638.     Demo.TxtQuote(FormatNum).Enabled = False
  639.     
  640. Case 19
  641.     Demo.CrystalReport1.PrintFileType = 18
  642.     Demo.TxtPrnFileName.Text = UCase(PrnFileName) & ".WPD"
  643.     Demo.ChkNumFormat(FormatNum).Enabled = False
  644.     Demo.ChkDateFormat(FormatNum).Enabled = False
  645.     Demo.LblSep(FormatNum).Enabled = False
  646.     Demo.LblQuote(FormatNum).Enabled = False
  647.     Demo.TxtSep(FormatNum).Enabled = False
  648.     Demo.TxtQuote(FormatNum).Enabled = False
  649.  
  650.  
  651. End Select
  652.  
  653. End Sub
  654.  
  655. Public Sub RptSection(SecNum As Integer)
  656. Dim Section As String
  657.     
  658.     Section = Demo.CboSecList(SecNum).ListIndex
  659.     
  660.     Select Case Section
  661.     
  662.     Case 0
  663.        ReportSection = "TITLE"
  664.         
  665.     Case 1
  666.        ReportSection = "HEADER"
  667.         
  668.     Case 2
  669.        ReportSection = "GH1"
  670.         
  671.     Case 3
  672.        ReportSection = "GH2"
  673.             
  674.     Case 4
  675.        ReportSection = "GH3"
  676.             
  677.     Case 5
  678.        ReportSection = "GH4"
  679.      
  680.     Case 6
  681.        ReportSection = "GH5"
  682.         
  683.     Case 7
  684.        ReportSection = "GH6"
  685.         
  686.     Case 8
  687.        ReportSection = "GH7"
  688.         
  689.     Case 9
  690.        ReportSection = "GH8"
  691.         
  692.     Case 10
  693.        ReportSection = "GH9"
  694.         
  695.     Case 11
  696.        ReportSection = "DETAIL"
  697.         
  698.     Case 12
  699.        ReportSection = "GF9"
  700.         
  701.     Case 13
  702.        ReportSection = "GF8"
  703.        
  704.     Case 14
  705.        ReportSection = "GF7"
  706.     
  707.     Case 15
  708.        ReportSection = "GF6"
  709.         
  710.     Case 16
  711.        ReportSection = "GF5"
  712.         
  713.     Case 17
  714.        ReportSection = "GF4"
  715.         
  716.     Case 18
  717.        ReportSection = "GF3"
  718.        
  719.     Case 19
  720.        ReportSection = "GF2"
  721.        
  722.     Case 20
  723.        ReportSection = "GF1"
  724.       
  725.     Case 21
  726.        ReportSection = "FOOTER"
  727.         
  728.     Case 22
  729.         ReportSection = "GRNDTTL"
  730.         
  731.     Case 23
  732.         ReportSection = "SUMMARY"
  733.         
  734.     Case 24
  735.         ReportSection = "ALL"
  736.         
  737.     End Select
  738.  
  739. 'All sections    ALL Group Footer 1 section  GF1
  740. 'Title section   TITLE   Group Footer 2 section  GF2
  741. 'Page Header section HEADER  Group Footer 3 section  GF3
  742. 'Group Header 1 section  GH1 Group Footer 4 section  GF4
  743. 'Group Header 2 section  GH2 Group Footer 5 section  GF5
  744. 'Group Header 3 section  GH3 Group Footer 6 section  GF6
  745. 'Group Header 4 section  GH4 Group Footer 7 section  GF7
  746. 'Group Header 5 section  GH5 Group Footer 8 section  GF8
  747. 'Group Header 6 section  GH6 Group Footer 9 section  GF9
  748. 'Group Header 7 section  GH7 Grand Total section GRNDTTL
  749. 'Group Header 8 section  GH8 Page Footer section FOOTER
  750. 'Group Header 9 section  GH9 Summary section SUMMARY
  751. 'Details section DETAIL
  752.  
  753. End Sub
  754.  
  755. Public Sub ChooseRpt()
  756. ' Sets a variable for the report filename, which requires both the path
  757. ' and file name to qualify
  758. Dim sReportFile, RptName As String
  759. Dim NameCnt, FileNameNum As Integer
  760.  
  761. ' Get the path from the FileList Control and the filename from the FileList Control and then
  762. ' assign this to a variable to be used with CrystalReport1.ReportFileName.
  763. sReportFile = Demo.FileList.Path & "\" & Demo.FileList.filename
  764. Demo.CrystalReport1.ReportFileName = sReportFile
  765.  
  766. Demo.ResetIndexes  'Reset all of the array indexes used in application
  767.  
  768.  
  769. Demo.Timer1.Interval = 2000    ' wait 2 seconds before enabaling all other tabs,
  770. With Demo.MainTab              ' and then automatically go to the next tab.
  771.     .TabEnabled(1) = True      ' activate all of the tabs so that they can be used.
  772.     .TabEnabled(2) = True      ' They are greyed out before a report is chosen.
  773.     .TabEnabled(3) = True
  774.     .TabEnabled(4) = True
  775. End With
  776.  
  777. Demo.CmdNext.Enabled = True         ' Enable the buttons on the bottom of the form to be
  778. Demo.CmdBack.Enabled = True         ' used once a report is chosen.
  779. Demo.CmdAccept.Enabled = True
  780. Demo.CmdCancel.Caption = "Close"
  781. Demo.MainTab.Tab = 1                   ' Set focus to the destination tab.
  782.  
  783. With Demo.DestTab
  784.     .TabEnabled(1) = False
  785.     .TabEnabled(2) = False
  786.     .TabEnabled(3) = False
  787.     .TabEnabled(4) = False
  788. End With
  789.  
  790.  
  791.  
  792. FileNameNum = 1
  793. NameCnt = 1
  794.  
  795. Do While RptName <> "."
  796.     PrnFileName = Left(Demo.FileList.filename, FileNameNum)
  797.     NameCnt = NameCnt + 1
  798.     RptName = Mid(Demo.FileList.filename, NameCnt, 1)
  799.     FileNameNum = FileNameNum + 1
  800. Loop
  801.  
  802.  
  803. Demo.LoadFileTypes
  804. Demo.LoadSections
  805. Demo.LoadCond
  806. Demo.LoadDataDir
  807.  
  808. End Sub
  809.  
  810. Public Sub GrpCondition()
  811. Dim Cond As String
  812.  
  813. Cond = Demo.CboCond.ListIndex
  814.  
  815. Select Case Cond
  816.  
  817. Case 0
  818.     GroupCondition = "ANYCHANGE"
  819.     
  820. Case 1
  821.     GroupCondition = "ANYCHANGE"
  822.        
  823. Case 2
  824.     GroupCondition = "DAILY"
  825.  
  826. Case 3
  827.     GroupCondition = "WEEKLY"
  828.     
  829. Case 4
  830.     GroupCondition = "BIWEEKLY"
  831.     
  832. Case 5
  833.     GroupCondition = "SEMIMONTHLY"
  834.  
  835. Case 6
  836.     GroupCondition = "MONTHLY"
  837.  
  838. Case 7
  839.     GroupCondition = "QUARTERLY"
  840.     
  841. Case 8
  842.     GroupCondition = "SEMIANNUALLY"
  843.  
  844. Case 9
  845.     GroupCondition = "ANNUALLY"
  846.  
  847. Case 10
  848.     GroupCondition = "ANYCHANGE"
  849.  
  850. Case 11
  851.     GroupCondition = "TOYES"
  852.     
  853. Case 12
  854.     GroupCondition = "TONO"
  855.     
  856. Case 13
  857.     GroupCondition = "EVERYYES"
  858.     
  859. Case 14
  860.     GroupCondition = "EVERYNO"
  861.     
  862. Case 15
  863.     GroupCondition = "NEXTISYES"
  864.     
  865. Case 16
  866.     GroupCondition = "NEXTISNO"
  867.     
  868. End Select
  869.  
  870.  
  871.  
  872.  
  873. End Sub
  874.