Solved

data reports

Posted on 2004-08-20
4
126 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

914 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

19 Experts available now in Live!

Get 1:1 Help Now