Solved

Visual Basic - Crystal Report

Posted on 2001-09-14
7
797 Views
Last Modified: 2013-11-25
I want to create report with the data i have in a True DB grid.



' My True DBGrid control - is a bound grid.

gsSqlStmt = "SELECT DateReceived FROM WorkOrder WHERE DateReceived > '8/1/01' and Datereceived < '8/30/01'
gsSqlStmt = gsSqlStmt & "Group BY DateReceived"
Set rdatCust.Resultset = grdoDTI.OpenResultset(gsSqlStmt, rdOpenStatic, rdConcurReadOnly)
 tdbgrdCust.Refresh

' (I have 1 bound column and 3 unbound columns. To fill the unbound columns i am using unboundcolumnfetch event of true db grid.

Private Sub tdbgrdCust_UnboundColumnFetch(Bookmark As Variant, ByVal Col As Integer, Value As Variant)
        Dim rrsTmp As rdoResultset
        Select Case Col
            Case 1
                gsSqlStmt = "SELECT COUNT(WorkOrderID) FROM WorkOrder WHERE DateReceived = '" & tdbgrdCust.Columns("DateReceived").CellText(Bookmark) & "'"
                Set rrsTmp = grdoDTI.OpenResultset(gsSqlStmt, rdOpenStatic, rdConcurReadOnly)
                If Not rrsTmp.EOF Then
                    Value = rrsTmp.rdoColumns(0).Value
                Else
                    Value = 0
                End If
            Case 2
               ' Some code like above to get value
            Case 3
                ' Some code like above to get value
        End Select
    Exit Sub
End Sub


' Then i am calling a routine to print the report
private sub PrintReport()
     'I set the crystal report control property
   CrystalReport1.ReportSource = crptTrueDBGrid
   CrystalReport1.ReportFileName = App.Path & "\Reports\" & "GRDRPT1.rpt"
   CrystalReport1.ReportSource = crptTrueDBGrid
   CrystalReport1.Destination =1
   CrystalReport1.Action = 1
end sub
   

' When  i am doing this -
Unbound column fetch event is firing again after    CrystalReport1.Action = 1

This is giving me the error:
Error: 40027
Application-deifned or object-defined error

Can any one help me why this is happening.

Thanks .
   
0
Comment
Question by:nkunapaneni
[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
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:trkcorp
ID: 6482821
Just a thought... have you considered using the print functionality inherent to True Grid?  You can very easily print an image of the grid with the printdata method.  There is a nice preview option available and you have a great deal of control over your output.  You can state headings, add page numbers, etceteras...  Taking this path you have to do very little other than invoke the method and set a few properties.
0
 

Author Comment

by:nkunapaneni
ID: 6483121
HI
Thanks for the suggestion. I tried to use the
tdbgrid.PrintInfo.PrintData to print (.PrintPReview - to preview).  When i preview it -
I am able to get the preview properly.
But when i print - The data in the unbound columns is lost.
That's really wierd.
Do you have any suggestions on this.
Thanks.
0
 
LVL 4

Expert Comment

by:trkcorp
ID: 6483146
That is really weird. I have done this many times and have never experienced anything like that and yes, I have had unbound columns and code very much like yours.  What version of TDBGrid are you using?  Have you applied the updates available from http://www.componentone.com/ I think I would if I hadn't...
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Author Comment

by:nkunapaneni
ID: 6483172
The one i am using is
APEX True DBGrid Pro 6.0c

I don't think that i have applied any updates to it.
Can you suggest which one should i be considering?

Thanks.
Nalini.
0
 
LVL 4

Accepted Solution

by:
trkcorp earned 100 total points
ID: 6483208
http://home.component1.com/cmd.boa?download=Product%2BUpdates&key=True%2BDBGrid%2BPro
Try this link.  The only update available is f, the last one before Ver 7.  I would apply this and see if my problems dissolve... Ver 6c I know was shipped as a CD somewhere in the cycle because that is what is on CD at my client's site, which I promptly upgraded to f... and my personal copy is at f.
0
 

Author Comment

by:nkunapaneni
ID: 6483211
I got the update from the site. Now it is printing properly.
 Thanks alot for the help.

Nalini.
0
 
LVL 4

Expert Comment

by:trkcorp
ID: 6483296
You are quite welcome.  That True Grid print option has come in handy many times for simple reports.  :)
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
windbg taking it's time 32 101
VB6 - Convert HH:MM into Decimal 8 70
What namespace do I need to import? 2 48
how to Classify of email (pdf attachments) 7 50
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

696 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