Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal 8.5 - Visual Basic "The memory could not be written"

Status
Not open for further replies.

MHirsh

IS-IT--Management
Nov 13, 2002
3
US
I am automating a batch print process (50 reports) using Excel/VB. The process aborts partially through the procedure with the following error message...

The instruction at "0x77fcbb5c" referenced memory at "0xffe00037". The memory count not be "written".

The instruction and memory location vary each time I run the procedure. The point at which the procedure aborts is different each time.

The latest Crystal SP's have been applied. Crystal Reports 8.5 ActiveX Designer Run Time Library and Crystal Reports 8.5 ActiveX Designer Design and Runtime Libraryreferences are included in the VB project.

Here is a sample of the code... Any Help will be appreciated. The frustration level increases geometrically with time!... Thanks!

============================================================
Code:
Dim crreport As CRAXDRT.Report
Dim crapplication As New CRAXDRT.Application

Dim reportfile As String                         
Dim FromPeriod As String                        
Dim ToPeriod As String                          
Dim Account As String  
Dim Orientation As Integer                      
Dim PaperSize As Integer
Dim Copies As Integer

Sheets("PrintGandA").Activate    
FromPeriod = Range("$C$7").Value
ToPeriod = Range("$C$8").Value
Copies = Range("$C$9").Value

crapplication.LogOnServer "pdsodbc.dll", "APP", "USR", "APP", "APPPWD"

' FIRST REPORT...
' ===============

Account = "751020"

reportfile = "S:T0_T4.rpt"   
Set crreport = crapplication.OpenReport(reportfile)

Orientation = crreport.PaperOrientation
PaperSize = crreport.PaperSize

' Clear Parms
' ===========

crreport.ParameterFields.GetItemByName("FromPeriod").ClearCurrentValueAndRange
crreport.ParameterFields.GetItemByName("ToPeriod").ClearCurrentValueAndRange
crreport.ParameterFields.GetItemByName("AccountCode").ClearCurrentValueAndRange

' Add Parms
' =========
crreport.ParameterFields.GetItemByName("FromPeriod").AddCurrentValue (FromPeriod)
crreport.ParameterFields.GetItemByName("ToPeriod").AddCurrentValue (ToPeriod)
crreport.ParameterFields.GetItemByName("AccountCode").AddCurrentValue (Account)
        
crreport.PrintOut False, Copies, True

Etc.....
 
...Forgive the typo. The error message should read "The memory COULD not be written."
 
Thanks for the reply, Rob. But the Crystal Reports were created using the CR DEVELOPER product (8.5.3.949). There are no DCA or DSR files. Any other ideas?

Thanks... Martin
 
I've had this problem before, but with CR9. It was something to do with the way I declared the Crystal Object. I've tried looking for the article on their website, but could not find it. I still might have it laying around. Let me check during a break.



Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top