I confirm that I have a "tblContents" with a filed "sponsor".
I have pasted the code into one line and I get a "compile Error" with
the selection on the semi colon in & ";",
Thanks,
Robin
Please always copy and paste any code that doesn't work into your
post. Sometimes there is a difference between what we think we wrote
and what is actually written. This is a human fact of life, and we all
do it.
1) Did you declare
intPageCount as Integer
in the Declaration's section of the code?
2) Do you give intPageCount a value in the Report Footer Format event?
inpPageCount = [Page]
3) Is Sponsor a Number datatype, Integer field size?
It should be.
4) Below is code copied exactly from a sample report I used, and it
works. The CurrentDb.Execute statement should all be on one line.
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As
Integer)
intPageCount = [Page]
CurrentDb.Execute "Update tblcontents Set tblContents.Sponsor = " &
[intPageCount] + 1 & ";", dbFailOnError
End Sub
Sometimes email readers split a line incorrectly and add > symbols.
Here is how the ending of the statement should appear:
tblContents.Sponsor = " & [intPageCount] + 1 & ";"