Not Enough Memory for operation error for Crystal reports 8.5

I am trying to send a crystal report 8.5 to the fax machine ( WinFAX Pro 10.03) via a click of the button in VB. The report itself generates fine in the Crystal reports design window itself.

While in VB Everything works fine here until it reaches the line with the ****.... I get "Not Enough Memory for Operation" error...    Any Ideas???? The system I am using it on has
memory to burn ...so I think it is something else????

Set dbDatabase = CurrentDb()

Set rs = New ADODB.Recordset
StrSql = "Select acctID,acctName,faxNum From tbl_Account WHERE docrtID=3"
rs.Open StrSql, goConn, adOpenForwardOnly

        strCompany = "Company Name"
        strReportName = "FAX REPORT"
       
        Chan = DDEInitiate("FAXMNG", "CONTROL")
       
        Do While Not rs.EOF
   
        Chan = DDEInitiate("FAXMNG", "TRANSMIT")
        DDEExecute Chan, "GoIdle"
       
        faxNum = Chr$(34) & rs![faxNumber] & Chr$(34)
        faxName = Chr$(34) & rs![accountName] & Chr$(34)
        faxCompany = Chr$(34) & strCompany & Chr$(34)
        faxSubject = Chr$(34) & strReportName & Chr$(34)
       
        SendCriteria = faxNum + ",,," + faxName + "," + faxCompany + "," + faxSubject
       
        DDEPoke Chan, "Sendfax", "showSendScreen(""0"")"
        DDEPoke Chan, "Sendfax", "fillCoverPage(""0"")"
        DDEPoke Chan, "Sendfax", "recipient(" + SendCriteria + ")"
       
     
        CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = '" & rs![accountID] & "'"

        CrystalReport1.Action = 1  **** ' this generates the error "NOT enough Memory for operation
        Call PauseSeconds(5)
        rs.MoveNext
    Loop

Any help would be much aprreciated!!!

Thanks,
Marc
nomar2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
The way you are doing this you are creating a new report instance for each record.

Try this

Eliminate the loop (comment it out temporarily) and see if you get the report sent.

Where is the code that sets up the report object?
You may need to do something like

 Do While Not rs.EOF
     SETUP THE REPORT
     YOUR CODE TO DIAL THE FAX
        CrystalReport1.Action = 1  
        Call PauseSeconds(5)
        SET CRYSTALREPORT1 = NOTHING
        rs.MoveNext
   Loop
 
mlmcc
0
nomar2Author Commented:
I have a crystal report control on the form that directs the report's destination  to the fax printer.

I commented out the loop just to see if it would fire the report and I still get the same error at the

CrystalReport1.Action = 1  

Runtime error 20500
Not enough memory for operation.

This has me stumped!!!!
0
vidruCommented:
Here's a KB article on that error with the OCX component:
http://support.businessobjects.com/library/kbase/articles/c2007694.asp

Try previewing the report as well to see if you get a different error (as the KB article suggests):

        CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = '" & rs![accountID] & "'"
        CrystalReport1.Destination = 0   'Preview to screen
        CrystalReport1.Action = 1

-dave
0
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

nomar2Author Commented:
Dave,

Okay that did generate a different error ...I know get

RunTime Error 20515

Error in Formula <Record Selection>
'{tbl_Account.accountID} ='15''
A number is required here.

Any ideas what I need here.

I thought my selection formula is good.

I appreciate this help.
0
mlmccCommented:
If the account id is a number then change to

  CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = " & rs![accountID]

mlmcc

0
nomar2Author Commented:
The accountID is a # ...I did your suggestion and  now I get the error.......

RunTime Error 20515

Error in Formula <Record Selection>
'
'
The remaining text does not appear to be part of the formula.


The problem definitely is around this selection formula...

I can't figure it out...

I appreciate this help..
0
vidruCommented:
Try:

CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = CDbl(" & rs![accountID] & ")"

-dave
0
mlmccCommented:
Try

CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = " & cstr(rs![accountID])

mlmcc
0
nomar2Author Commented:
I tried both

CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = CDbl(" & rs![accountID] & ")"

AND

CrystalReport1.SelectionFormula = "{tbl_Account.accountID} = " & cstr(rs![accountID])

both produced this error

RunTime Error 20515

Error in Formula <Record Selection>
'
'
The remaining text does not appear to be part of the formula.

I can't think how else I can code this selection formula.

The help is much appreciated.

0
nomar2Author Commented:
In order to use a selection formula through VB   ie ..

CrystalReport1.SelectionFormula = whatever....

Do I need to have anything done in the design of the crystal report itself in order for this to work in VB or in VB do I need certain references/components checked in order for the selection formula to work???

Right now I don't have anything done...allthough I have just for testing purposes inserted a selection formula via the Report/Edit Selection formula/Record in the design window itself and it returns the selected record(s).

0
vidruCommented:
If your record selection will always be "tbl_Account.accountID} = x", you could add a parameter to the report ({?AccountID}).  Then instead of passing the selection formula from VB, you would just pass the parameter value like this:

  CrystalReport1.ParameterFields(1) = "AccountID;" & rs![accountID] & ";True"

-dave
0
nomar2Author Commented:
Just thinking out loud....

I was also wondering about the use of a parameter field in the selection formula...right now I am not making use of any parameter field itself in the report itself.

I thought if I just wanted to pick certain records based on certain criteria and then print these reports I would just need to execute the selection formula and based on the accountId returned that certain report would be faxed via the use of the loop in the VB code.
0
vidruCommented:
I think I just found your problem.  Is there anything in your record selection formula right now?  I just ran a simple test, and wasn't getting the error you're getting until I put nothing but a space in the record selection formula.  When I went back in and cleared it out, it worked fine.

If you want to completely replace the selection formula (if any) at runtime, use the ReplaceSelectionFormula method instead of SelectionFormula:

  CrystalReport1.ReplaceSelectionFormula "{tbl_Account.accountID} = " & rs![accountID]

-dave
0
nomar2Author Commented:
Okay I created a new parameter called (accountID), it is a # and I selected a radio button option of discrete values.


Remember...
I am using the Sql statement at the beginning of my code block to retrieve the accountID

 "Select accountID,acctName,faxNum From tbl_Account WHERE docrtID=3"



When you say add a parameter to the report ({?AccountID}) , do you mean dragging the parameter onto the report itself  and making it a  hidden field or do you mean adding this parameter to a Report/Edit Selection formula/Record  ie ...

{tbl_Account.accountID} = {?AccountID}
0
nomar2Author Commented:
Dave,

  I inserted

CrystalReport1.ReplaceSelectionFormula ( "{tbl_Account.accountID} = " & rs![accountID])
CrystalReport1.Destination = 0   'Preview to screen
CrystalReport1.Action = 1

It goes all the way through and then stops at...

CrystalReport1.Action = 1

and then i get the error

Runtime Error 20599
Cannot open SQL server



0
vidruCommented:
You need to pass in a valid userid/pwd so the report can connect to the server.  You do that using the report's Connect property:

    Report.Connect[=DataSourceName;UserID;Password;DatabaseQualifier$]

Unless you need to change either the db or DSN name at runtime, you should be able to get by with passing just UID and PWD:
 
   CrystalReport1.Connect = "uid=" & strUser & ";pwd=" & strPwd & ";"

-dave
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
nomar2Author Commented:
Dave,

  IT IS WORKING!!!!!

I changed the DSN based on these instructions  

To remove the Datasource name from the report, use the following steps to
accomplish this:

1. After the report is created select "Convert Database Driver" from the
"Database" Menu. Check the "Convert Database Driver on next refresh" box and
reselect the pdsmon.dll driver and then click OK.

2. Click "Cancel" on the Select Data Source Dialogue. The Server Type and Server
Name Settings in the Database | Set Location dialogue are now set to New. The
report will now accept the recordset without any other Connection required,
however the report can no longer be previewed in the Crystal Report Designer.

AND VOILA!!!

The single reports are being faxed!!!!

A million thank-yous!!!!

Have a great weekend!!

Definitely 500 points well used.....Thanks Dave


0
vidruCommented:
Fantastic... glad you got it working.

-dave
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.