Solved

data reports

Posted on 2004-08-20
4
125 Views
Last Modified: 2010-05-02
Hi..

Can someone please help me on data reports in Visual Basic 6.0?

I have a table with a list of employees.  One of the field contains the filename for the image file (.JPG).  I created a data report with an Image control.  I want to be able to print out the employee with their picture in it.  The objective of the application is to print identification cards for all the employees in the table.   I am using one of those Avery business card papers to print the cards.

However, I can't seem to find the property that would allow me to assign value to the Image control.  I am able to show the Name and IDs but not the picture.  The image control allow me to specify a fixed file but not to dynamically assign a filename.

Please help..  I hope I was able to explain my dilemma clearly.

Thank you for all you experts out there.
0
Comment
Question by:winpiglet
4 Comments
 
LVL 18

Accepted Solution

by:
JR2003 earned 500 total points
ID: 11854116
The only way you can dynamically assign a picture to a report image is to do it once before you run the report.  This would mean that you have to run a report for each employee. It's probably not what you want but here it is anyway.

1) Add a new data report to your project
2) Draw an image control in the top of the report in the report header (section4)
3) Write a function in the report module:

Public Function LoadImage(sFileName As String)

    Set Me.Sections.Item("Section4").Controls("Image1").Picture = LoadPicture(sFileName)
   
End Function

When you run the report you'd do something like this:

Private Sub Command1_Click()

    With DataReport1
        .LoadImage "c:\a.jpg"
        etc...
        .Show
    End With
End Sub

You can only change the image once per run of the report.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

746 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

16 Experts available now in Live!

Get 1:1 Help Now