Solved

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

Posted on 2006-07-10
6
341 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
stringclean challenge 26 73
WMI, model #, retrieving information 10 137
wordlen challenge 3 66
Basic Java Case or If-Else statement... 3 50
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now