07 Nov 2009 @ 2:25 AM 

Preview:

CR10

Visual Basic 6 and Crystal Reports 10 reference

I received emails from a person call Paul. He told me that he is unable to open my project using Crystal Reports 10 so I decided to modified my previous project to load images in Crystal Reports 10 using Visual Basic 6 connected to MS Access 2000 and MS SQL Server 2000.

Updated 28 Nov 2009:
Common Mistake
If you have followed my Tutorial (page 19-29), you may find out that I have renamed the objects in the report using VB6. Unfortunately I may have created a confusion by renaming the default Fieldx to adoFileName. Some readers may interpret it as ado.FileName and hence replacing the code with the following line.
If .Item("ado.FileName").Value <> "" Then
Set bmp = LoadPicture(App.Path & "\Cake\" & .Item("ado.FileName").Value)
Set .Item("picCake").FormattedPicture = bmp
Else
Set .Item("picCake").FormattedPicture = LoadPicture("")
End If

Please do not follow the name when you hover the mouse pointer on the report design! Use the name shown in the VB IDE properties window.

i.e:
Wrong: .Item(“ado.FileName”).Value
Correct: .Item(“FileName”).Value

Related posts:
Load Images in Crystal Reports dynamically with Access 2000
Crystal Reports Tutorial Update

Download: Source Code (505KB)

The zip file contains MS Access 2000, MS SQL 2000 database backup, Crystal Report file, VB6 source code and some images.

Keywords: Visual Basic 6.0, VB6, ActiveX Data Object Control, ADO 2.8, Access 2000, SQL Server, password, print, Crystal Reports, 10.2, 10.5, CRAXDRT, CRAXDDRT, section, dynamic, images, load

Posted By: Aeric
Last Edit: 28 Nov 2009 @ 02:04 AM

EmailPermalinkComments (7)
Tags
 09 Feb 2009 @ 6:29 PM 

I have received two emails recently on response to my tutorial at Planet Source Code.

Please refer to previous post on

Load Images in Crystal Reports dynamically with Access 2000

Email 1:

hi
thank you for crystal report pdf file for load image into report
i need a pdf file or sample code vb for  save and load  blob field into database and report
thank
ali asad

First email was asking me on how to save and load BLOB field into database and display into Crystal Reports. I use a sample project to load BLOB data and then integtrate with my project to load image using crystal reports. Tadaa… it works! but the image dimension to save into the database must be same with the image dimension during the time the report is designed.

Download: Source Code

Email 2:

Thanks so much for your tutorial (attached).

I have some questions, if you’re willing ……

How to suppress the image if the image is the default?

If the image is suppressed, how to squeeze the section vertically to remove the space that the image would have taken up, but leave any detail that is in the section?

John Collett

The second email was asking me on how to suppress the default image or suppress the empty space if no image is loaded for a particular record. I use some tricks to suppress the section. I also attach some snapshots to show the method graphically.

Download: Source Code

Please remember to vote for me in planet source code, thanks!

http://www.planet-source-code.com/vb/scripts/showcode.asp?txtCodeId=70000&lngWid=1

Related posts:
Load Images in Crystal Reports dynamically with Access 2000
Load Dynamic Image in Crystal Reports 10 using Visual Basic 6

Posted By: Aeric
Last Edit: 22 Feb 2010 @ 12:18 AM

EmailPermalinkComments (4)
Tags
 10 Apr 2008 @ 3:51 PM 

Preview of the Tutorial

Your computer must have the following softwares installed:

1. MS Visual Basic 6.0 (Updated with SP6 recommended)

2. Seagate Crystal Reports 8.5 Developer Edition

3. MS Access 97, 2000 or 2003 (From MS Office 2000/XP/2003 suite)

4. Adobe Reader (to open the Tutorial.pdf)

Recommendation:

Please use Microsoft ActiveX Data Control 2.5 or higher (I use MDAC 2.8)

Please note that this tutorial is not applied for prior version of Visual Basic (4/5) or VB.Net, other Crystal Reports products like Crystal Decision/Enterprise/Professional/Crystal Report 9 or later or MS Access 2005 or later. If you have any question on how to use it with other type of database system like MS SQL Server 2000, please post it here. I shall try to help. Currently I have just started to learn to use MySQL and will look at VB.Net when I am free.

In this tutorial, I am using MS Access 2000 format with password set to it. It is recommended to set the database password with length more than 20 character. I use is ADO method to connect to the database. If you prefer DAO, please tell me.

I assume you have some basic programming skills in Visual Basic 6. I am trying to make my tutorial as simple as I could. Please ask if you have any problem understanding the code.

For the method of embedding Crystal Reports to Visual Basic 6, the method explained in the tutorial is the easiest one in my opinion. I am using a CRViewer component to load external *.RPT file which I think is better than using the Crystal Reports ActiveX control (OCX ) method. There is another method by using Report Designer Component (RDC) where the report design is embedded into the project. Perhaps it is good way to protect your report design but this will create VB temporary files (*.TMP) in your C:\ path and you need to recompile the exe if you want to change the report design.

I think many programmers are looking for the method to load dynamic image in the report. Before I found this solution, I have tried many methods including load static pictures and some code only allow me to load bitmap files. Another method is by loading OLE data from the database which I try to avoid because I don’t want my database file to grow bigger. MS Access file has a limitation to store a file size more than 2GB where I learn from other forum or articles. So in this tutorial, it only load the path to the image file from a database table and update the picture in the report. A visitor who downloaded my tutorial has asked me whether he can load a BLOB data from the database. I have a solution for him and it also support PNG file whereas the project in my tutorial only able to load BMP, JPG and GIF files.

Tutorial File: PDF ZIP
VB6 Project: Source Code

Related post:
Crystal Reports Tutorial Update
Load Dynamic Image in Crystal Reports 10 using Visual Basic 6

Posted By: Aeric
Last Edit: 23 Feb 2010 @ 08:51 PM

EmailPermalinkComments (3)
Tags

 Last 50 Posts
 Back
Change Theme...
  • Users » 2
  • Posts/Pages » 129
  • Comments » 194
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight