Solved

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

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

746 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