Help with Photo for badges

C

charles.kendricks

I have a client database from which I am trying to print picture ID
badges. My approach was to create a small report that displays
client
name, SSN, and picture as well as some other information. The
pictures are stored in a folder on disk C:\photos and are named with
the client SSN. I want to be able to get more than just one card per
sheet of paper, so the report size is only about 2" in height and
41/2" wide. I'm thinking that I should see the detail section
repeated vertically on the page with a different card in each section
of the final printed page. My problem is that while the name and SSN
change for each card the picture stays the same, which is the picture
of the first person. The code I'm using in the On Activate action
that follows:

Private Sub Report_Activate()
Dim strFile As String
Dim strDefFile As String
Dim strFullPath As String
Dim strDefFullPath As String


' Be sure to amend photo path and image control


strFullPath = strPhotodir + Me!SSN + ".bmp"
strDefFullPath = strPhotodir + "Bitmaps\Med5.gif"
strFile = Dir(strFullPath, vbNormal)
strDefFile = Dir(strDefFullPath, vbNormal)


If (strFile <> vbNullString) Then
Image15.Picture = strFullPath
Else
Image15.Picture = "strDefFullPath"
End If
End Sub
 
L

Larry Linson

Do you mean that you intended to execute a single Report for each badge? If
so, unless you jumped through some flaming hoops, each would start on a
separate page.

If, on the other hand, you have created a Report with a Detail Section size
as you want, and are executing it once for a Query/Table you have set as its
Record Source, then I'm not surprised -- the Activate event runs one time,
at the beginning of the Report.

Did you have the idea that it runs for each Record, each Detail Section?
The events that run for each Detail Section are the Format and the Print
events. Try putting your code in the Print event of the Detail Section.

One additional comment, if there is no photo path-and-file information,
wouldn't you want to use the default path-and-file you've created in the
variable strDefFullPath in the Picture property, rather than the text
"strDefFullPath"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top