p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access (http://p2p.wrox.com/forumdisplay.php?f=18)
-   -   Table of Contents in a Report (http://p2p.wrox.com/showthread.php?t=73135)

Odeh Naber March 6th, 2009 12:39 PM

Table of Contents in a Report
 
Hiya Folks!

I tried following the instructions from MS Article ID 131588 for creating a Table of Contents in an Access report but it doesnt work at all. The first time I tried it, absolutely nothing happened. The second time I tried it, I get a 424 Runtime Error: 'object required' error in the line:

toctable.Seek "=", tocentry

I checked and rechecked all the instructions and everything that the instructions say, i have done.

My report has approx 117 pages, and I am trying to create a Table of Contents that will have more or less the format below (see at the end of this message - I included the example to illustrate how many levels and sublevels in my report):

Any advice!? :)

Thank you!

Odeh

-Restaurant
-----Food
---------Cold Starters-----------1
---------Hot Starters-----------2
---------Meat-----------3
---------Fish-----------4
---------Desserts-----------5
----Drinks
---------Soft Drinks-----------6
---------Red Wine-----------7
---------White Wine-----------8
-----Tabaco
---------Cigarettes-----------9
---------Cigars-----------10

-Bar
-----Food
---------Cold Starters-----------11
---------Desserts-----------12
----Drinks
---------Red Wine-----------13
---------White Wine-----------14

-Terrace
-----Tabaco
---------Cigarettes-----------15
---------Cigars-----------16

mmcdonal March 11th, 2009 08:19 AM

I found this article. Does it help?

http://en.allexperts.com/q/Using-MS-...tents-page.htm

Odeh Naber March 23rd, 2009 04:45 AM

Will try and let you know!
 
Thanks for the link! Will try it and let you know!

Regards!

Odeh Naber March 23rd, 2009 07:14 AM

Run-Time Error 424
 
Hi Again!

I followed the instructiona and I keep receiving the following error message:

Run-Time Error 424 - Object Required

When I click on Debug, it highlights the following line:

TocTable.Seek "=", TocEntry

When I hover the mouse over the following line of the same function (on the part before the '=' symbol, it shows the 'object required' popup window:

TocTable!Description = TocEntry

I checked all the instruction carefully and I did everything as it it says, including to verify that the datatype of the 'description' field and the field that contains the data to go into the Table of Contents are the same.

I added the DAO 3.6 library as well.

I did have the following doubt though - but I am unsure if they are related to the problem: Is a primary key required in the 'Table of Contents' table? Tried to create one but it also didnt work.

The table of contents table is always empty.

Any advice? Thank you!

Odeh Naber March 23rd, 2009 07:39 AM

Copy Paste Field to Table of Contents Table
 
I tried to do the following to see if there is any results - and also to ensure that the two fields are exactly the same:

I opened the table in design view (the one which holds the data that I want to eventually appear in the Table of Contents (TOC) table). I copied the line that has the definition of the field that I want copied to the TOC table and I pasted it in the TOC table. I then renamed it in the TOC table as Description. And I changed the Index option to Yes No Duplicates.

I then tried to preview the report and I get the following runtime error:

Runtime Error 3800: 'Description' is not an index in this table

When I click on the Debug button it highlights the following line:

TocTable.Index = "Description"

I am assuming this is because I have duplicate descriptions in the main table (which I do). I then tried to remove .Index from that line, and I get the first runtime error that I reported earlier: 424.

Any advice?

Thanks!

mmcdonal March 23rd, 2009 08:01 AM

What if you index the description field, and then allow duplicates. Would that work? I don't think it needs a PK field to work.

Odeh Naber March 23rd, 2009 08:12 AM

Hi again!

I just tried to do that - and now it gives the Runtime Error 424 (object required) message.

Again it is highlighting the following line in the debugger:

TocTable.Seek "=", TocEntry

Just to add (not sure if this helps in anyway):

With regards to this line: TocTable.Seek "=", TocEntry
when I hover on 'TocTable.Seek', no popups appear.
when I hover on 'TocEntry', a little popup appears with the name of one of the recipes - in this case 'Chicken Soup'.

And with regards to this line: TocTable!Description = TocEntry
when I hover on 'TocTable!Description', this little popup appears:
TocTable!Description = <Object Require>
when I hover on 'TocEntry', a little popup appears with the same name of one of the recipes as happened above - in this case 'Chicken Soup'.

With regards to this line: TocTable![page number] = intPageCounter
when I hover on 'TocTable![page number]', no popups appear.
when I hover on 'intPageCounter', this little popup appears:
intPageCounter = Empty

Any other clues as to what may be causing this? Thanks again!

mmcdonal March 23rd, 2009 08:15 AM

Can you do a make table query with Select Distinct, make the Description field Indexed (No Duplicates) in the new table, and then run this on that new table and see if the error recurs?

Odeh Naber March 23rd, 2009 08:36 AM

Make Table Query
 
Sorry to bother you - I never created a make table query before.

So lets see if what I did is correct:

First I deleted the 'Table of Contents' table that we created before, right?

Then I went to Create New Query in Design View, and I selected the table that contains the recipe names (example: Chicken Soup). Then I select from the drop-down option in the toolbar the Make-Table Query. It asks for a table name - I typed in 'Table of Contents'.

Then I ran the query and a new table 'Table of Contents' was created. The Description Field was originally named 'PortugueseDescription' so I changed it to 'Description'. And then I added in the new table the 'Page Number' field. I clicked on my report and I got exactly the same runtime error message 424 - object required.

Is this what you wanted me to try - just to be sure I understood correctly? After I closed the debugger and I checked the table - it was completely empty.

Thanks!

mmcdonal March 23rd, 2009 08:40 AM

Sorry, I meant create a new table for the data that your report is being run on. But limit the records to unique items, and then delete some data so that you can index the Description field. Then run the report on that new table. It will still need the TOC table. I wanted to see what would happen if the description field were unique indexed.


All times are GMT -4. The time now is 07:37 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.