Solved

Time Field coming up blank in a report (Using VB6, Crystal Reports 8 and IBM DB2)

Posted on 2006-07-10
6
344 Views
Last Modified: 2012-06-27
I've created a report and the Time field is coming up blank. I'm using VB6, Crystal Reports 8 and IBM DB2 database. All other fields show up correctly on the report, except for the Time field. The field from the table that I'm querying from is TIME type. When looking at the data from the db it shows both the date and time. Any help would be appreciated.
0
Comment
Question by:TimHietanen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 17077080
Please post code used in querying the database. Please provide all CR code.


Brian
0
 

Author Comment

by:TimHietanen
ID: 17077212
This is the canned code that I've used for all reports in my applications. Probabley around 40 reports.

Private Sub RUN_REPORT()
'// PRINT THE INFO IN A CRYSTAL REPORT
Dim strConn     As String
Dim rptMain     As Object
Dim Conn        As ADODB.Connection
Dim rstMain     As New ADODB.Recordset
Dim strSQLMain  As String

'// OPEN DATA CONNECTION
Set Conn = New ADODB.Connection
strConn = gstrShapeString

If Conn.State = adStateOpen Then
   Conn.Close
End If
Conn.ConnectionString = strConn
Conn.Open

'// GENERATE SQL FOR REPORT
strSQLMain = GENERATE_RPT_SQL

'// OPEN RECORDSET
rstMain.Open strSQLMain, Conn

Set rptMain = New dtrFurnLogRpt

'// CREATE A NEW CR INSTANCE FOR THE MAIN REPORT
rptMain.DiscardSavedData

'// BIND SQL TO REPORT
rptMain.Database.SetDataSource rstMain
rptMain.ReadRecords

'// LOAD THE frmReport FORM
Load frmReport

With frmReport
   .WindowState = vbMaximized
   .CRViewer1.ReportSource = rptMain
   .CRViewer1.DisplayGroupTree = False
   .CRViewer1.Zoom 100
   .CRViewer1.ViewReport
'SET THE REPORT OBJECT - NEED THIS IN ORDER TO EXPORT THE FORM TO WORD, EXCEL...
   Set .crxReport = rptMain
   .Show
End With

'// RS/CONNECTION CLEANUP
rstMain.Close
Set rstMain = Nothing
Set Conn = Nothing

Screen.MousePointer = vbDefault
Exit Sub

errHandler:
   Screen.MousePointer = vbDefault
   MsgBox Err.Number & vbCrLf & vbCrLf & Err.Description
End Sub


Private Function GENERATE_RPT_SQL() As String

Dim strQry    As String

strQry = ""
strQry = strQry & " SELECT PROD.FURNACE_LOG.FURNACE_LOG_ID, PROD.FURNACE_LOG.REC_DATE, ERP.SHIFT.EXTERNAL_SOURCE_KEY"
strQry = strQry & "  CONCAT ' - ' CONCAT ERP.SHIFT.NAME AS ShiftName, EQUIP.EQUIPMENT.EXTERNAL_SOURCE_KEY"
strQry = strQry & "  CONCAT ' - ' CONCAT EQUIP.EQUIPMENT.NAME AS EquipName, PROD.FURNACE_LOG.SIDE, CASE"
strQry = strQry & "  PROD.FURNACE_LOG.APPROVED WHEN 0 THEN 'No' ELSE 'Yes' END AS Approved, PROD.SLAG_SKIM.START, "
strQry = strQry & "  PROD.SLAG_SKIM.FINISH, PROD.SLAG_SKIM.AVG_TEMP, PROD.SLAG_SKIM.MAX_TEMP, PROD.SLAG_SKIM.COMM"
strQry = strQry & "  FROM PROD.FURNACE_LOG LEFT OUTER JOIN PROD.SLAG_SKIM ON PROD.FURNACE_LOG.FURNACE_LOG_ID"
strQry = strQry & "  = PROD.SLAG_SKIM.FURNACE_LOG_ID LEFT OUTER JOIN ERP.SHIFT ON PROD.FURNACE_LOG.SHIFT_ID"
strQry = strQry & "  = ERP.SHIFT.SHIFT_ID LEFT OUTER JOIN EQUIP.EQUIPMENT ON PROD.FURNACE_LOG.EQUIPMENT_ID"
strQry = strQry & "  = EQUIP.EQUIPMENT.EQUIPMENT_ID where PROD.FURNACE_LOG.Furnace_Log_ID = " & glngFurnLogID & ""

GENERATE_RPT_SQL = strQry
End Function
0
 
LVL 7

Accepted Solution

by:
assyst earned 250 total points
ID: 17079365
Place a Datetime field in the crystal report and if you just want to display the time part, customize the datetime field accordingly to get the time part. and if this is not helping, try
converting the datetime field in the query to varchar and check the report. i think if you are
applying the second method. i.e the convertion you will get rid of the issue.

Good Luck
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Simple Linear Regression

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question