• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1315
  • Last Modified:

Visual Basic 6 with Crystal Reports 7 Help!

im trying to edit an picture object in my report, im using vb6 and cr7, im not using a blob or ole object in my database but path of the image. ive looked at support.crystaldecisions.com but when i tried their solution:

Set crxMyPictureObject.FormattedPicture = LoadPicture("C:\picture.bmp")

an error occured prompting "permission denied". ive seached crystal decisions and said my picture image must be in a subreport but it isnt. need help! please! thanks!
0
manduz_griffus
Asked:
manduz_griffus
1 Solution
 
manduz_griffusAuthor Commented:
thanks mlmcc! that worked when i include the report in the project, but what im using is an independent report outside my project.

i code it like this:

Public crxApplication As New CRAXDRT.Application
Public crxReport As CRAXDRT.Report
Public crxDatabase As CRAXDRT.Database
Public crxDatabaseTables As CRAXDRT.DatabaseTables
Public crxDatabaseTable As CRAXDRT.DatabaseTable
Public crxSections As CRAXDRT.Sections
Public crxSection As CRAXDRT.Section
Public crxPictureObject As CRAXDRT.OLEObject

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
Set crxReport = crxApplication.OpenReport("C:\MyReport.rpt")
crxReport.DiscardSavedData
Set crxDatabase = crxReport.Database
Set crxDatabaseTables = crxDatabase.Tables
For Each crxDatabaseTable In crxDatabaseTables
    crxDatabaseTable.Location = "C:\MyDatabase.mdb"
Next crxDatabaseTable
CRViewer1.ReportSource = crxReport
Set crxPictureObject = crxReport.Sections("PH").ReportObjects.Item(10)
Set crxPictureObject.FormattedPicture = LoadPicture("C:\MyPicture.jpg")
CRViewer1.ViewReport
Me.WindowState = vbMaximized
Screen.MousePointer = vbDefault
End Sub

hope you could help me more.
thanks anyways!
0
 
mlmccCommented:
How about changing the order of these lines

CRViewer1.ReportSource = crxReport
Set crxPictureObject = crxReport.Sections("PH").ReportObjects.Item(10)
Set crxPictureObject.FormattedPicture = LoadPicture("C:\MyPicture.jpg")


Try
Set crxPictureObject = crxReport.Sections("PH").ReportObjects.Item(10)
Set crxPictureObject.FormattedPicture = LoadPicture("C:\MyPicture.jpg")
CRViewer1.ReportSource = crxReport


mlmcc
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
manduz_griffusAuthor Commented:
hi mlmcc! thanks again! but the error 70 "permission denied" still occurs.

when i tried doing the solution in the link to crystal decisions the error also occured when i didn't put the code in the corresponding section where the picture object is placed, but when i put it on the right section it already worked, but it only works when the report is included in the project and in using an independent report outside my project. i really need to know how to do it. it will help me a lot.

i really thank you for your time!
0
 
mlmccCommented:
I assume you can place the picture in the report?  You aren't having a file permission error by chance?

mlmcc
0
 
mlmccCommented:
This seems to apply but I am not sure how.

http://support.crystaldecisions.com/library/kbase/articles/c2007698.asp

http://support.crystaldecisions.com/library/kbase/articles/c2006500.asp

According to these you can only change objects in a section in that sections format event.

mlmcc
0
 
manduz_griffusAuthor Commented:
thanks again mlmcc! these solutions worked when i include or a a crystal report in my vb project. but what im trying to use is an independent report(crystal report) save as .rpt file not added to my vb project.
its really important to me.
thanks very much!
0
 
mlmccCommented:
This seems to be a permissions problem rather than a CR problem.

What references to CR have you included with your project?

mlmcc
0
 
manduz_griffusAuthor Commented:
hi mlmcc!

i've included crystal report smart viewer and
crystal report 7 activex designer run time library in my references.
should i include other references?

again, thank you very much!

manduz_griffus

0
 
CleanupPingCommented:
manduz_griffus:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
mlmccCommented:
Sorry.  Must have missed the update.  Can you run reports that don't include pictures?

Delete the picture from that report and try to display it from the VB application.

mlmcc
0
 
DanRollinsCommented:
Moderator, my recommended disposition is:

    Accept mlmcc's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now