home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / VISUAL_B / REFERENC / CRYS_REP / README.TXT next >
Encoding:
Text File  |  1994-04-23  |  3.1 KB  |  77 lines

  1. Crystal Report / MS Access Time Formats
  2.  
  3. Date:        4/23/94
  4. Author:        Thomas Becker
  5. Compuserve ID:    73473,1363
  6.  
  7. Subject:    Format of MS Access Time fields in Crystal Reports
  8.  
  9. Crystal Report 2.0 (packaged with VB Pro 3.0) does not handle Time
  10. formatting for MS Access fields defined as "Date/Time".  Crystal Report Pro
  11. 3.0 will handle Time formatting for MS Access ONLY if the database is
  12. accessed via ODBC.
  13.  
  14. I have developed three Crystal Reports formulas that will format Time from
  15. an MS Access database in the following formats:
  16.  
  17.           Format    FileName
  18.           ------    --------        
  19.         12:00 AM/PM    Time_1.txt
  20.         24:00        Time_2.txt
  21.         24:00:00    Time_3.txt
  22.  
  23. The only catch is, the MS Access Time field must be defined as a DOUBLE (not
  24. Date/Time).  This is not a problem if you maintain your Date and Time fields
  25. on your database as separate fields. These formulas will NOT work for
  26. fields that are used for Date/Time Stamps (Date and Time in the same field).
  27. The reason is, that Crystal Reports will no longer recognize the Date part
  28. of the field as a Date (and I have not, and probably will not provide a
  29. formula that will convert a DOUBLE to a Date field).
  30.  
  31. I have provided three text files for the Time format formulas, as listed
  32. above.  These formulas should work in Crystal Reports 2.0 or 3.0 (Pro or
  33. Standard).
  34.  
  35. Following are the steps to install into Crystal Reports:
  36.  
  37.      1. Run Crystal Reports Report designer.
  38.      2. Load an existing report or start a new one.
  39.      3. Minimize Crystal Reports down to an icon.
  40.      4. Open a text editor (like Windows Note Pad).
  41.      5. Load the desired Time Format Text file (Time_1.txt, Time_2.txt,
  42.         or Time_3.txt).
  43.      6. Highlight all text in the file and Copy to the Clipboard.
  44.      7. Double click on the Crystal Reports icon to re-activate Crystal
  45.         Reports.    
  46.      8. Select Insert|Formula from the main menu.
  47.      9. Assign a new formula name and press enter.
  48.     10. Press Shift+Insert to paste the Time format text into your
  49.         formula.
  50.     11. On the 4th line of the formula is a database field name
  51.         "{Time.Time}".  Change this field name to your Time field name.
  52.     12. Click the "Accept" button and place the field on your report. 
  53.  
  54. You will need to create a formula for each Time field on your report.
  55.  
  56. The other concern with changing your MS Access Time fields to DOUBLE, is
  57. how do you handle these field in your VB program.  Most of my Time fields
  58. are updated and displayed using TrueGrid.  TrueGrid will handle a Time field
  59. in "Date/Time" or "DOUBLE" format equally well.  Just set the properties
  60. Format to "hh:mm AM/PM" or "hh:mm:ss" or what ever.
  61.  
  62. For a Text Box, assign the "TEXT" property of the text box to a Format,
  63. for example:
  64.  
  65.         Text1.Text = Format(t#,"hh:mm AM/PM")
  66.                 or
  67.         Text1.Text = Format(Data1.Recordset("Time"),"hh:mm AM/PM")
  68.  
  69. If you are currently using a bound Text box, you will need to change it to
  70. unbound and place the second example above in the Data Control Reposition
  71. Event.
  72.  
  73. This isn't the best answer, but it may help until Crystal Services gets it's
  74. act together and provides Time Formatting for MS Access.
  75.  
  76. Enjoy,
  77. Tom