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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Not Found

Status
Not open for further replies.

smil3y

IS-IT--Management
Jan 8, 2004
79
AU
Up until recently I have been using VB6 to create crystal reports (8.5) very reliably.

I create my form (ie crSelect.dsr) - use the VB Data environment to handle the data (ie SQL data set) and then use code such as below to display the form.

Private Sub LoadAllSections()
Dim SQL As String
Dim StrConnect As String

Set rsadoReport = New ADODB.Recordset

SQL = "SELECT Company.Company, Employee.LastName, Employee.FirstName, Employee.HomePhone," & _
" Employee.MobilePhone, Employee.ReportHide, Company.CompanyID FROM Company INNER JOIN" & _
" Employee ON Company.CompanyID = Employee.CompanyID Where (((Employee.ReportHide) = False))" & _
" ORDER BY Company.Company, Employee.LastName"

rsadoReport.Open SQL, Con, adOpenDynamic, adLockBatchOptimistic
SectionReport.DiscardSavedData
SectionReport.Database.SetDataSource rsadoReport
CRVReport.ReportSource = SectionReport
SectionReport.CompanyName.SetText CompanyName
SectionReport.PaperSize = crPaperA4

CRVReport.ViewReport
CRVReport.Zoom 1

Screen.MousePointer = vbDefault

End Sub

This SQL statement is basically the same as the Data Environment SQL statement. I then use a Refresh call to modify the statement and select a particular CompanyID. this all works fine.

I have just had a requirement to create two crystal forms in the same application that do not require refreshing so I used the following code for each respectively.

Private Sub LoadHoursReport()
Dim SQL As String


Set rsadoReport = New ADODB.Recordset

SQL = "SELECT Sum(manhours.Manhours) AS SumYearHours, Company.Company FROM manhours INNER JOIN" & _
" Company ON manhours.CompanyID = Company.CompanyID Where (((manhours.RptDate) > 0))" & _
" GROUP BY Company.Company, manhours.CompanyID"

rsadoReport.Open SQL, Con, adOpenDynamic, adLockBatchOptimistic

Debug.Print SQL

HoursReport.DiscardSavedData
CRVReport.EnableGroupTree = False
HoursReport.txtHours.SetText "TOTAL HOURS WORKED"
CRVReport.ReportSource = HoursReport
HoursReport.CompanyName.SetText CompanyName
HoursReport.PaperSize = crPaperA4
CRVReport.ViewReport
CRVReport.Zoom 1
Screen.MousePointer = vbDefault

End Sub

AND

Private Sub LoadTerminationReport()
Dim SQL As String

TermReport.DiscardSavedData
CRVReport.EnableGroupTree = False
CRVReport.ReportSource = TermReport
TermReport.CompanyName.SetText CompanyName
TermReport.PaperSize = crPaperA4
CRVReport.ViewReport
CRVReport.Zoom 1
Screen.MousePointer = vbDefault

End Sub

For these reports the Data Environment holds the same SQL statements for LoadHoursReport and for LoadTermreport only Data Environment SQL statement is used.

These reports work fine so long as they are run first. I can run these reports and then run the ones like LoadAll Sections - everything works fine BUT if I run the LoadAllSection report first, these last two will NOT run - I just get a 'FILE NOT FOUND' message from crystal.

Has anyone got any ideas on why this is happening.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top