PDA

Click to See Complete Forum and Search --> : CR4 not showing updates


PeterBorroloola
Apr 16th, 2006, 04:43 AM
Hi all, I'm doing a db front-end with vb6, Access'97, coding with DAO3.6, reporting with CR4.6

Just prior to printing the report, I recalculate a few things and update a yes/no field in the db:
Private Sub cmdReport_Click()

Dim Interval As Single, varBookmark

With rstShow
varBookmark = .Bookmark
.MoveFirst
Do While Not .EOF
.Edit
If IsNull(!lastcheck) Then
!due = True
Else
Interval = (DateDiff("d", !lastcheck, Now)) / 7
If Interval > !frequency Then
!due = True
Else
!due = False
End If
Debug.Print !Name & " " & !lastcheck & " " & !frequency & " " & !due
End If
.Update
.MoveNext
Loop
.Bookmark = varBookmark
End With

DoEvents

crpReports.Destination = 0
crpReports.PrintReport
crpReports.ReportFileName = "FTT.rpt"

End Sub
The debug.print in there shows that the values are updated ("due" is the yes/no field). However, when the report prints, the changes are not reflected. If you print the report again straight away, without making any changes, the changes are shown in the report.

Why not the first time??? :eek2:

I've unchecked 'save data with report', checked 'verify on every print', checked 'refresh data on every print' and unchecked 'save data with closed report'. Unless the good lads at Seagate have got another option buried somewhere I think I've got that sorted.

Any ideas???? Peter

PeterBorroloola
Apr 16th, 2006, 10:14 PM
I've got around the problem by putting the 'update' code in a separate sub, and calling that from the write subs (lostfocus of text boxes, click event of a combobox).

I can't see why it didn't work the first way though :ehh: If anyone knows, I'd like to hear.

tks, Peter