Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Visual Basic - Crystal Report

Posted on 2001-09-14
7
Medium Priority
?
809 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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 400 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

670 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