Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Unwwanted .tmp files with Crystal 8.5/Visual Basic 6.0

Posted on 2004-04-05
Medium Priority
Last Modified: 2007-12-19
I have an application which uses Crystal Reports for reporting. At runtime, each time a report is created, a zero length .tmp file (e.g. 10E.tmp) is created under the root directory. These file persists when the application closes.  I am closing, set to nothing etc everything I can think of at program termination. Can anyone tell me what to do to stop proliferation of these files? (These files are only created when a Crystal Report is created and they are NOT the design time files from VB/Crystal). I can't find an answer anywhere except the general advice to clean up 'everything' at close. Please be as specific as possible  if you have a suggestion. Thanks.

Question by:SSC2004
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
  • 2
LVL 18

Expert Comment

ID: 10758220
They are removed when you set all Crystal reports related variables to Nothing. Please recheck whether you are setting all crystal variables to nothing. Also post the code

Author Comment

ID: 10758770
I am not sure what variables you refer to. I also am not sure I have the correct syntax. Is it possible to set the viewer to nothing? Examples are welcome. Here is a code sample. There are many reports in this application, I have tried to pare down the code to include all the variables. The situation is the same no matter which report is created. Thanks very much for you help.

*On the form that shows the reports :
Dim Report As CRAXDRT.Report
Public DisplayDateRange As String
Public DisplayPlaceField
Option Explicit
Private Sub Form_Load()
Dim ProjectTitle As String
Dim ReportTitle As String
ProjectTitle = "NJ"
ReportTitle = frmReport.frameParams
 Set Report = New CRHelp
Report.ParameterFields.GetItemByName("ParamTitle").AddCurrentValue  ReportTitle
Report.ParameterFields.GetItemByName("ParamNJ").AddCurrentValue ProjectTitle  
CRViewer1.ReportSource = Report
Report.Database.Tables(1).Location = AppPath & "NJ.mdb"
Private Sub Form_Unload(Cancel As Integer)
Set Report = Nothing
End Sub

*Below is the module that is called at program termination

Public Sub UnloadAllForms()
Dim Form As Form

'close all the recordsets by name   (each recordset is closed individually by name for lack of a better way)
'set all the Crystal reports to nothing (each crystal report is closed by name)
Set CRHelp = Nothing

'Unload and Set all the forms to nothing
 For Each Form In Forms
    Unload Form
    Set Form = Nothing
 Next Form
'close all the workspaces and database
Do While Workspaces(0).Databases.Count > 0
Set dbNJ = Nothing
End Sub
LVL 18

Accepted Solution

Sethi earned 1500 total points
ID: 10758998
What you are doing in your code is absolutely correct. However, the following links would answer your question:

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 10759428
That's interesting and sounds similar. The article refers to crw###.tmp when exporting to a pdf but this happens when I view the report and my files are named ###.tmp so I am not sure this is the same thing. I am going to check the service packs but believe we may be up to date.  I have not found any CRW### files out there.

Author Comment

ID: 10776046

After several tries, I received the following from Crystal Support ...

"Is the application developed using RDC? If yes, then we have come across such a problem that is a known issue for applications using the RDC engine and appears to be specific to Windows XP. The track number is ADAPT00090506. The temp files may be of 0-byte in size and get left in the root directory of the drive running the application. This is an issue with versions 8.5 and 9."

The only workaround they suggested was a batch job to delete files which is not practical in the distributed (consumer) environment for my application. If anyone has found a workaround, please let me know.

Thanks to all who had a look at this question.


Author Comment

ID: 10932209
Further discussion with Crystal support included the following solution:

"The ADAPT00090506 referenced is not in the external Knowledge Base but it exactly describes your findings - Temp files being created in the root directory only on XP. The problem is with the .dsr files you create inside Visual Basic when creating your reports.

The problem is corrected in the latest version of the RDC in Crystal Reports 10.

The workaround in Crystal Reports 8.5 is to create the report in the Crystal Reports designer as an .rpt file and load it as an external report. You can save your .dsr as a report by right clicking on the report, going to the Report menu and choosing Save to Crystal Reports file.

To load it as an external report, the code would be:

Dim crxApplication As New CRAXDRT.Application
Dim External_Report As CRAXDRT.Report

Private Sub Form_Load()
Screen.MousePointer = vbHourglass

'Using the MS CommonDialog control to prompt for a report name CommonDialog1.InitDir = App.Path CommonDialog1.Filter = "RPT Files (*.rpt)|*.rpt" CommonDialog1.ShowOpen

ReportFileName = CommonDialog1.FileName

Set External_Report = crxApplication.OpenReport(ReportFileName, 1)

'Or opening the report using the path to the report
'Set External_Report = crxApplication.OpenReport("C:\1 - Reports\BasicSQL.rpt", 1)

CRViewer1.EnableExportButton = True
CRViewer1.ReportSource = External_Report

Screen.MousePointer = vbDefault

End Sub

These reports are not embedded in the application and would need to be distributed with your application. "

Points to Sethi for taking a look at it and getting me far enough along to press Crystal for the facts. This problem only seems to exist when the application is run on xp.

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

610 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