A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

OnPrint Function Error



 
 
Thread Tools Display Modes
  #11  
Old July 27th, 2007, 02:32 PM posted to microsoft.public.access.reports
Pam
external usenet poster
 
Posts: 131
Default OnPrint Function Error

Marsh,

I didn't change anything. I clicked to the left on the first line of
UpdateToc and it changed the line to red and added a dot. I exited that
window and went to report preview and then the error msg popped up. I went
back and compared the code with what I copied form Northwind and all is
still the same.
Pam

"Marshall Barton" wrote in message
...
We're going backwards ;-)

That message implies that the UpdateToc function can not be
found. Did you do something else to change things around.

S P E C I A L N O T E
Do not edit any code in the report's module while in break
mode (a line highlighted in yellow). Use Debug - Stop to
end code execution and switch the report back to design view
before editing anything in the module.
--
Marsh
MVP [MS Access]


Pam wrote:
I did as you suggested and am now getting error msg: Access can't find the
macro: '=UpdateToc(Nz([PartNumber], "Unknown Part"), [Report])'


"Marshall Barton" wrote
Try placing a break point on the first line in the UpdateToc
function (just clisk on the left margin of the line and it
will turn dark red when it's set). Then switch the report
to Preview and the code will stop when it hits the break
point. See what you can learn from stepping through from
there.


I've included the code I'm using.
Hopefully,
you will be able to tell why this won't work for me.

Option Compare Database

Dim db As DAO.Database
Dim TocTable As DAO.Recordset


Function InitToc()
Set db = CurrentDb()
db.Execute "Delete* From [Table Of Contents]"
Set TocTable = db.OpenRecordset("Table Of Contents", dbOpenTable)
TocTable.Index = "Description"

End Function

Function UpdateToc(TocEntry As String, Rpt As Report)
TocTable.Seek "=", TocEntry

If TocTable.NoMatch Then
TocTable.AddNew
TocTable!Description = TocEntry
TocTable![Page Number] = Rpt.Page
TocTable.Update
End If

End Function
OnOpen Property for report
=InitToc()

OnPrint Property for group (partnumber) header
=UpdateToc([PartNumber],[Report])





  #12  
Old July 27th, 2007, 04:59 PM posted to microsoft.public.access.reports
Pam
external usenet poster
 
Posts: 131
Default OnPrint Function Error

Marsh,

I've got it working and you're going to think I'm such a moron. The text
box for the field PartNumber was named Text68. When I changed the code to
read =UpdateToc([Text68], Report), it worked and I felt like an idiot for
overlooking it. I was reading the group header title on report design.

Thank you for your help and time. As always, it is greatly appreciated.
Pam

"Marshall Barton" wrote in message
...
We're going backwards ;-)

That message implies that the UpdateToc function can not be
found. Did you do something else to change things around.

S P E C I A L N O T E
Do not edit any code in the report's module while in break
mode (a line highlighted in yellow). Use Debug - Stop to
end code execution and switch the report back to design view
before editing anything in the module.
--
Marsh
MVP [MS Access]


Pam wrote:
I did as you suggested and am now getting error msg: Access can't find the
macro: '=UpdateToc(Nz([PartNumber], "Unknown Part"), [Report])'


"Marshall Barton" wrote
Try placing a break point on the first line in the UpdateToc
function (just clisk on the left margin of the line and it
will turn dark red when it's set). Then switch the report
to Preview and the code will stop when it hits the break
point. See what you can learn from stepping through from
there.


I've included the code I'm using.
Hopefully,
you will be able to tell why this won't work for me.

Option Compare Database

Dim db As DAO.Database
Dim TocTable As DAO.Recordset


Function InitToc()
Set db = CurrentDb()
db.Execute "Delete* From [Table Of Contents]"
Set TocTable = db.OpenRecordset("Table Of Contents", dbOpenTable)
TocTable.Index = "Description"

End Function

Function UpdateToc(TocEntry As String, Rpt As Report)
TocTable.Seek "=", TocEntry

If TocTable.NoMatch Then
TocTable.AddNew
TocTable!Description = TocEntry
TocTable![Page Number] = Rpt.Page
TocTable.Update
End If

End Function
OnOpen Property for report
=InitToc()

OnPrint Property for group (partnumber) header
=UpdateToc([PartNumber],[Report])





  #13  
Old July 27th, 2007, 08:15 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default OnPrint Function Error

That kind of mistake can be very difficult to notice. I
guess both of us should up the priority of double checking
the names of everything in the code being discussed.
--
Marsh
MVP [MS Access]


Pam wrote:
I've got it working and you're going to think I'm such a moron. The text
box for the field PartNumber was named Text68. When I changed the code to
read =UpdateToc([Text68], Report), it worked and I felt like an idiot for
overlooking it. I was reading the group header title on report design.

"Marshall Barton" wrote
That message implies that the UpdateToc function can not be
found. Did you do something else to change things around.

S P E C I A L N O T E
Do not edit any code in the report's module while in break
mode (a line highlighted in yellow). Use Debug - Stop to
end code execution and switch the report back to design view
before editing anything in the module.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:39 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.