Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bunnyEars challenge 6 103
C Programming - If Statement 8 72
Help to convert powershell script into a gui 9 142
Arduino EDI - Programming Language - Voice Recorder 4 70
This article will show, step by step, how to integrate R code into a R Sweave document
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

861 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

23 Experts available now in Live!

Get 1:1 Help Now