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

Errors Occurring In Pre-Existing Programs After XP Migration

Status
Not open for further replies.

drosenkranz

Programmer
Sep 13, 2000
360
US
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 <> &quot;&quot; And mstrName <> &quot;&quot; Then
'
'store mvars to Crystal Report Table
On Error GoTo ErrHandler
'
Dim sqlCommand As String
datCrystal.DatabaseName = mstrRptSpec
sqlCommand = &quot;Select * from Report&quot;
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 & &quot;\ClientAttendance.rpt&quot;
CrystalReport1.DataFiles(0) = mstrDataBase
CrystalReport1.DataFiles(1) = mstrRptSpec
CrystalReport1.DataFiles(2) = mstrDataBase
CrystalReport1.DataFiles(3) = &quot;&quot;
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.
 
What maybe happening or rather not happening is that the update is not being flushed to disk before Crystal is reading it. If that is the case then you may need some code to flush the data, this will depend on the data access methods being used - search MSDN for refreshcache.

As I recall if you are using DAO adding the following statement after the updaterecord may help.

dbEngine.Idle( dbRefreshCache )

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top