Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Basic - Crystal Report

Posted on 2001-09-14
7
Medium Priority
?
813 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

971 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