Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tutorial on how to load images in crystal reports dynamically using visual basic 6 and access 2000

20,354 views

Published on

This tutorial will show you how to create a Visual Basic 6 project which will generate a report using Seagate Crystal Reports 8.5 Developer Edition. You will save the path of the image files in a MS Access database where it is protected by password. This project will use an external Crystal Report file and will be previewed using Crystal Viewer control.

Published in: Software
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THE BOOK INTO AVAILABLE FORMAT (New Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... Download doc Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THE can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THE is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBOOK .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookBOOK, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, EBOOK, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THE Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THE the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THE Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi there! I just wanted to share a list of sites that helped me a lot during my studies: .................................................................................................................................... www.EssayWrite.best - Write an essay .................................................................................................................................... www.LitReview.xyz - Summary of books .................................................................................................................................... www.Coursework.best - Online coursework .................................................................................................................................... www.Dissertations.me - proquest dissertations .................................................................................................................................... www.ReMovie.club - Movies reviews .................................................................................................................................... www.WebSlides.vip - Best powerpoint presentations .................................................................................................................................... www.WritePaper.info - Write a research paper .................................................................................................................................... www.EddyHelp.com - Homework help online .................................................................................................................................... www.MyResumeHelp.net - Professional resume writing service .................................................................................................................................. www.HelpWriting.net - Help with writing any papers ......................................................................................................................................... Save so as not to lose
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Loving the plans. Got lots of different ideas and inspiration. I'm sending you a photo of a bed frame I did for my daughter! ●●● https://t.cn/A62YeZUX
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Tutorial on how to load images in crystal reports dynamically using visual basic 6 and access 2000

  1. 1. Tutorial on How to Load images in Crystal Reports dynamically Using Visual Basic 6 and Access 2000 By Aeric Poon Introduction This tutorial will show you how to create a Visual Basic 6 project which will generate a report using Seagate Crystal Reports 8.5 Developer Edition. You will save the path of the image files in a MS Access database where it is protected by password. This project will use an external Crystal Report file and will be previewed using Crystal Viewer control. Get Ready In this tutorial, I will use some small images I get from forwarded email. I created a folder name Tutorial where all the files will be store inside this folder. I also created some images with different type like bmp, jpg, gif, png and tif which will be stored inside a folder name Cake. Contents Step 1 Create a Database file using MS Access Step 2 Create a Crystal Reports file Step 3 Create a Visual Basic Project Step 1 Create a Database file using MS Access Run MS Access to create a blank database. Create a folder name Data. In the File New Database dialogue box, type the name dbCake (dbCake.mdb) and click on Create to save this file inside folder Data. You have now created a database file.
  2. 2. Click on Create table in Design view. Click the Design button to create a new table. Create the following fields in the new table: CakeID (Text), CakeName (Text), FileName (Text) Set focus at CakeID and then click the Primary Key button to make this field as Primary Key.
  3. 3. Close the Table window or click Save button. Save this table name as Cake. Right click and Open table Cake.
  4. 4. Insert some records in the table Cake. Save and Close the table Cake. Set a Database Password. For this tutorial, I set the password as yuMMy20.
  5. 5. Click OK and Close this file. Now you have a database file ready. Step 2 Create a Crystal Reports file Run Crystal Reports 8.5 Developer. Click on As a Blank Report radio button in the Crystal Report Gallery dialogue box and click OK.
  6. 6. You will see a Data Explorer dialogue box. Click on the plus sign of More Data Sources. Click on the plus sign of Active Data and then click on Active Data (ADO).
  7. 7. You will see a Select Data Source dialogue box. Choose MS Access Database from the dropdown list and click OK. Browse for the Data folder where we store the database file, click dbCake.mdb and then click OK.
  8. 8. A Login dialogue will pop out. Enter yuMMy20 for the password and click OK. Then you will be asking to choose the database again. Click on dbCake.mdb and click OK.
  9. 9. You will be brought back to Data Explorer and you will notice there is an icon for ado. We have successfully connected the Report with the database. Click on Add button. You will see a Select Recordset dialogue box.
  10. 10. Click on SQL radio button so you can change the query if you want to do so. This is useful if you have WHERE keyword in the SQL statement to filter the records. After you have modified your SQL query, click on OK. Now you can see there is a green tick at the ado icon in Data Explorer. Click Close.
  11. 11. Now you will see a Field Explorer dialogue box. Click on the plus sign next to Database Fields:. Click on the plus sign next to ado and you will see all the fields generated from the SQL query.
  12. 12. Drag and drop or click on the field and press Enter to insert the field to the report. Add more fields to the report in Details section and resize the width as your preference.
  13. 13. Click on Insert Picture icon to insert image file. If you couldn t find the tool, click on menu View, Toolbars and check the Supplementary Tools checkbox. Browse for an image to insert. Resize it to fit your report. Format the appearance of the picture object like adding borders.
  14. 14. You can modify the report design by adding lines, box, labels for company title and address or put a logo. Click on Preview tab to show how the report will look like. In this stage, the picture is fixed.
  15. 15. Click on menu File and uncheck the Save Data with Report option. Save this report with filename Catalogue (Catalogue.rpt) inside folder Report.
  16. 16. Step 3 Create a Visual Basic Project You have the database and report file ready. So, the final step is to create the front-end using MS Visual Basic 6. Create a new Standard EXE by clicking Open. Right click the Toolbar and click on Components
  17. 17. Scroll down to look for Crystal Report Viewer Control. Check the checkbox next to it. Click on Designers tab. Check on Crystal Reports 8.5 and click OK.
  18. 18. Click on menu Project and click References Look for Microsoft ActiveX Data Objects 2.8 Library (Latest version of ADO control). Check the checkbox next to it.
  19. 19. Add also the Crystal Reports 8.5 ActiveX Designer Run Time Library and click OK. Right click the Project Explorer, click Add and then click on Crystal Reports 8.5
  20. 20. Click on the From an Existing Report radio button and click OK. Browse for the report file we have designed just now and click Open.
  21. 21. On the Crystal Report Expert dialogue box, click No radio button for the upper option. You can notice that Details section is named Section5 in bracket. You can change the name of the section if you like.
  22. 22. To hide the FileName field, right click the FileName field and click on Format . On the Common tab, check the checkbox next to Suppress.
  23. 23. Hide the Report Header and Report Footer by right click the section separator and click on Suppress (No Drill-Down). If you have made changes in the database table, right click the ado and click verify database.
  24. 24. You will be asked for the database password. Key in the password and click OK. A Select Recordset dialogue box will appear. Click OK if the SQL is correct.
  25. 25. A message will pop up to inform you that the ado has changed. Click OK. I have added a new field Price in the database table. Click OK to continue.
  26. 26. Now, click at the plus sign of ado and you can see the new field is added. Drag and drop the new field and set HorAlignment to crLeftAlign.
  27. 27. Rename Picture1 as picCake and Field5 for FileName as adoFileName. Right click inside any section, click on Report and click Save to Crystal reports File .
  28. 28. Browse for the report file and click Yes to replace it. Make a backup if you wish to do so. Click OK to proceed.
  29. 29. Remove the report designer if you want as we are going to use the external report file. Right click on the Project Explorer and click on Module.
  30. 30. Click Open to add the new Module. Insert the following code and save the module as modCake. Option Explicit Public cn As ADODB.Connection Public crx As New CRAXDRT.Application Public Function OpenDatabase() As Boolean On Error GoTo checkErr Set cn = New ADODB.Connection cn.Provider = "Microsoft.Jet.OLEDB.4.0" cn.ConnectionString = "Data Source=" & App.Path & "DatadbCake.mdb" cn.Properties("Jet OLEDB:Database Password") = "yuMMy20" cn.Open OpenDatabase = True Exit Function checkErr: MsgBox Err.Description, vbExclamation, Err.Number End Function The code above is for connecting to the Access 2000 database with password protected using ADO. It is recommended to encrypt the password for higher security. The Crystal Report Application is also set in this module as a Public variable.
  31. 31. Click on Form1. Add a button name cmdPrint on Form1. Change the button caption to Print Catalogue. Change Form1 BorderStyle as Fixed Single and caption or icon if you like.
  32. 32. Click View Code and insert the following code in Form1 and save it as frmPrint. Option Explicit Private Sub cmdPrint_Click() frmReport.WindowState = 2 frmReport.Show Unload Me End Sub Private Sub Form_Load() If OpenDatabase = False Then Unload Me Exit Sub End If End Sub The above code will connect to the database when the Form loads. If the database failed to load, check the database path, filename and password. If the application failed to start, it will quit. The print button will open a report form which we are going to create later. The report form will be open as a Maximized window. Now add a new form. Click CRViewer to add a Crystal Report Viewer object on this form. Add the following code and save the form as frmReport. Option Explicit Dim rpt As CRAXDRT.Report Dim db As CRAXDRT.Database Dim rs As New ADODB.Recordset Dim WithEvents sect As CRAXDRT.Section
  33. 33. Private Sub Form_Load() Screen.MousePointer = vbHourglass Set rpt = crx.OpenReport(App.Path & "ReportCatalogue.rpt") Set db = rpt.Database Set sect = rpt.Sections("Section5") rs.Open "SELECT * FROM Cake", cn, 1, 1 rpt.Database.SetDataSource rs, 3, 1 CRViewer1.ReportSource = rpt CRViewer1.ViewReport CRViewer1.Zoom 1 Screen.MousePointer = vbDefault End Sub Private Sub Form_Resize() CRViewer1.Top = 0 CRViewer1.Left = 0 CRViewer1.Height = ScaleHeight CRViewer1.Width = ScaleWidth End Sub Private Sub Form_Unload(Cancel As Integer) cn.Close End Sub Private Sub sect_Format(ByVal pFormattingInfo As Object) Dim bmp As StdPicture On Error Resume Next With sect.ReportObjects Set .Item("picCake").FormattedPicture = LoadPicture(App.Path & "Cakeck99.gif") 'default If .Item("adoFileName").Value <> "" Then Set bmp = LoadPicture(App.Path & "Cake" & .Item("adoFileName").Value) Set .Item("picCake").FormattedPicture = bmp End If End With End Sub
  34. 34. Now we have finished all the coding. Click on Start button to execute the project. Click on the Print Catalogue button.
  35. 35. The report preview will show up. Click the printer button if you want to print the report. This is how the trick works. Happy Coding. Please send me an email at aeric80 [at] gmail [dot] com if you found any mistakes in this document or you want to suggest any improvement.

×