Click to See Complete Forum and Search --> : help me to creat report with Crystal Report 8
Rob3161
Apr 23rd, 2006, 12:58 PM
I Just Installed Crystal Report 8 on my comp. I want to use it with VB6 and access database.. i need basic help to start with it .. if anyone can give me one basic software codes written in VB6 and Access Database and small tip to start with.
Have a nice day
Hitu
Hack
Apr 24th, 2006, 05:57 AM
I have edited your thread and removed your email address.
You should never put your email address in an open post on an open forum (any open forum). Mail spam bots can pick that up and before you know it, your mailbox is full of junk mail.
Is this your first experience with Crystal? Do you know how to create a basic report form?
Satyan_03
Apr 24th, 2006, 06:45 AM
hi Rob,
The following code is a sample one which I used to work in VB. I will explain my function. I am working in VB6 with CR 8.1. Database MS Access.
For Crystal Reports, I used to have test table to fetch data into the reports. The table structure will contain all the fields that are available in the report.
First design the report with the database connectivity. Save the file in a local folder where you have your proj file. Then addthe following two in Project References & Components.
Crystal Report Viewer Control.
Crystal Report Control.
Add Crystal Report Component to your form.
Then create a private function and add the following code.
add this report to your project(by right-clicking the Proj in Solution Explorer, you will get a window. browse for the file, Select it. Don't forget to check the Add as Related Document CheckBox(it should be checked))
call this function in button click event.
Dim Flag As String
Dim shouldprint As Boolean
If Flag = "" Then
shouldprint = False
End If
Flag = ""
With CrystalReport1
.Reset
.WindowWidth = 1025
.WindowTop = 63
.WindowLeft = 1
.WindowHeight = 620
.WindowBorderStyle = crptNoBorder
.Connect = connectionobject.ConnectionString
.WindowShowCloseBtn = True
.WindowState = crptMaximized
.WindowShowPrintBtn = True
.WindowShowPrintSetupBtn = True
.WindowShowSearchBtn = True
.WindowShowGroupTree = True
.SQLQuery = " SELECT * FROM <TABLENAME>
Set recordset = connectionobject.Execute(.SQLQuery)
If recordset.RecordCount > 0 Then
.ReportFileName = "D:\Satyan\Report.rpt"
.WindowShowExportBtn = False
If Not shouldprint Then
.Destination = crptToWindow
.Action = 1
End If
hndle = GetActiveWindow
Else
MsgBox " No Records Found "
End If
End With
Flag = "" .
.SQlQuery is the Query u r passing to the crystal reports from VB.
Reply if the above code works.. If u have doubts, reply me.
Satyan.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.