drosenkranz
Programmer
Hello,
I'm running an "in-house" system with VB 5.0 SP(3) and Access '97 that employs the Crystal Reports 7.0 OCX as the reporting mechanism. Since we moved from Win 95/98's onto new XP machines, I've noticed a small glitch in an area of a program that as been operating reliably for years.
A user selects a menu option for Client Attendance. The screen opens to a search engine where they input a seven position case number (a letter C or S followed by 6 numeric digits). If they find a matching client, then this case number is stored in a local table with only one record in it - which is used to temporarily store things like a case number, report scopes (dates), and so on.
Then a Crystal Report is called up and sent to print a letter based on the case number which just got stored in that user's local table. I thought this was a simple looping problem but it's not. Here's the problem...
The first person's appointment letter come out fine. The next person that's looked up is displayed but when you push the <P>rint Appointment Letter, the last client's info is on appointment letter. When you look up a third client, the second client's info prints. So EACH TIME, your letter is for the last person you tried to print.
I'm Stumped... any ideas? (Code Below)
Thanks,
Dave
If mstrCaseNo <> "" And mstrName <> "" Then
'
'store mvars to Crystal Report Table
On Error GoTo ErrHandler
'
Dim sqlCommand As String
datCrystal.DatabaseName = mstrRptSpec
sqlCommand = "Select * from Report"
datCrystal.RecordSource = sqlCommand
datCrystal.Refresh
'
With datCrystal.Recordset
.Edit
!CaseNo = mstrCaseNo
!PCode = mstrPCode
End With
datCrystal.UpdateRecord
'
On Error GoTo CrystalReportsBusy
'Print ClientAttendance.rpt here
CrystalReport1.ReportFileName = mstrAppPath & "\ClientAttendance.rpt"
CrystalReport1.DataFiles(0) = mstrDataBase
CrystalReport1.DataFiles(1) = mstrRptSpec
CrystalReport1.DataFiles(2) = mstrDataBase
CrystalReport1.DataFiles(3) = ""
CrystalReport1.Connect = mstrCrystalConnect
Screen.MousePointer = vbDefault
CrystalReport1.Destination = crptToWindow
'CrystalReport1.Destination = crptToPrinter
CrystalReport1.Action = 1
On Error GoTo 0
The 2nd mouse gets the cheese.
I'm running an "in-house" system with VB 5.0 SP(3) and Access '97 that employs the Crystal Reports 7.0 OCX as the reporting mechanism. Since we moved from Win 95/98's onto new XP machines, I've noticed a small glitch in an area of a program that as been operating reliably for years.
A user selects a menu option for Client Attendance. The screen opens to a search engine where they input a seven position case number (a letter C or S followed by 6 numeric digits). If they find a matching client, then this case number is stored in a local table with only one record in it - which is used to temporarily store things like a case number, report scopes (dates), and so on.
Then a Crystal Report is called up and sent to print a letter based on the case number which just got stored in that user's local table. I thought this was a simple looping problem but it's not. Here's the problem...
The first person's appointment letter come out fine. The next person that's looked up is displayed but when you push the <P>rint Appointment Letter, the last client's info is on appointment letter. When you look up a third client, the second client's info prints. So EACH TIME, your letter is for the last person you tried to print.
I'm Stumped... any ideas? (Code Below)
Thanks,
Dave
If mstrCaseNo <> "" And mstrName <> "" Then
'
'store mvars to Crystal Report Table
On Error GoTo ErrHandler
'
Dim sqlCommand As String
datCrystal.DatabaseName = mstrRptSpec
sqlCommand = "Select * from Report"
datCrystal.RecordSource = sqlCommand
datCrystal.Refresh
'
With datCrystal.Recordset
.Edit
!CaseNo = mstrCaseNo
!PCode = mstrPCode
End With
datCrystal.UpdateRecord
'
On Error GoTo CrystalReportsBusy
'Print ClientAttendance.rpt here
CrystalReport1.ReportFileName = mstrAppPath & "\ClientAttendance.rpt"
CrystalReport1.DataFiles(0) = mstrDataBase
CrystalReport1.DataFiles(1) = mstrRptSpec
CrystalReport1.DataFiles(2) = mstrDataBase
CrystalReport1.DataFiles(3) = ""
CrystalReport1.Connect = mstrCrystalConnect
Screen.MousePointer = vbDefault
CrystalReport1.Destination = crptToWindow
'CrystalReport1.Destination = crptToPrinter
CrystalReport1.Action = 1
On Error GoTo 0
The 2nd mouse gets the cheese.