[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MS Access Printing lables with pictures VBA

Posted on 2006-06-21
10
Medium Priority
?
300 Views
Last Modified: 2009-12-16
Hi Experts:
I am developing an Access Application in which user modifies the data. There is an image sitting outside of database in jpeg format. Which shows up in the form. Now I need to print this picture on a lable page with two lables on it. I have crystal reports 8.5 and VB6 and I am good with VB6 but have not used Crystal Reports at all. Again, This app lets users edit a access database table and I need to print Badges from this database table which has name and other info and picture path field in the table points to the jpg picture. The Badge paper is Avery Photo Id badge Inserts #2944. It is 4X6 size and can print two badges. Please provide full example code.
0
Comment
Question by:dhamijap
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
10 Comments
 
LVL 17

Expert Comment

by:Arji
ID: 16966424
Just curious if  you have tried using the label wizard from within Access to try your labels(badges)  You should also be able place a picture on the label just as you would on any report or form.  In fact if you are are already displaying a picture on a form, you can put the form in edit mode and literally copy and paste the picture control from the form to the badg/label.  Of course your printer will be criticial in how it all comes out anyway.
0
 

Author Comment

by:dhamijap
ID: 17266087
I got it myself Thanks for your help
Pradeep
0
 
LVL 17

Expert Comment

by:Arji
ID: 17266339
Please post your solution for the benefit of others on EE.  Also, if you solved the problem yourself, you can close this question by contacting Community Support.
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
LVL 17

Expert Comment

by:Arji
ID: 17774247
My only objection is that dhamijap didn't post his solution.  I think it would be helpful for the EE database and I'd like to know how it was done.
0
 

Author Comment

by:dhamijap
ID: 17774398
I used the report in ms access here is all the code:

Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo ErrHandler            
    If LevelCode < 3 Then
        boxBoundry.BackColor = 255
    Else
        boxBoundry.BackColor = 65408
    End If
    lblLogo.BackColor = BadgeFlag
    imgPatientPicture.Picture = PicturePath
    lblDate.Caption = Date
    DoCmd.Restore
Exit Sub
ErrHandler:
Dim sErrorNumber As Long
Dim sErrorDescription As String
    sErrorNumber = Err.Number
    sErrorDescription = Err.Description
    MsgBox "Error Number: " & sErrorNumber & vbCrLf & " Description: " & sErrorDescription
End Sub

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If Cancel = 0 Then
        DoEvents
    End If
    DoEvents
End Sub

Option Compare Database
Option Explicit

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo ErrHandler
    lblDate.Caption = Date
    imgPatientPicture.Picture = PicturePath
    If LevelCode < 3 Then
        boxBoundry.BackColor = 255
    Else
        boxBoundry.BackColor = 65408
    End If
    lblLogo.BackColor = BadgeFlag
    DoCmd.Restore
Exit Sub
ErrHandler:
 Dim sErrorNumber As Long
 Dim sErrorDescription As String
    sErrorNumber = Err.Number
    sErrorDescription = Err.Description
    MsgBox "Error Number: " & sErrorNumber & vbCrLf & " Description: " & sErrorDescription
    Resume
End Sub
0
 
LVL 17

Expert Comment

by:Arji
ID: 17775290
Looks good. I have one small suggestion:

This:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    If Cancel = 0 Then
        DoEvents
    End If
    DoEvents
End Sub

Is the same as this:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
     DoEvents
End Sub

Since you are doing DoEvents regardless of whether Cancel = 0 or not, you don't need the If...Then construct.
0
 

Author Comment

by:dhamijap
ID: 17775404
yes u r right I did not look at that just coped and pasted. basically whole sub do not need to be there.
dhamijap
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 17804490
PAQed with points refunded (125)

DarthMod
Community Support Moderator
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

656 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