Solved

Visual Basic - Crystal Report

Posted on 2001-09-14
7
774 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
  • 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

19 Experts available now in Live!

Get 1:1 Help Now