page numbering -- continue from previous post

E

Elsie

hi, think I got the hang of it... except for this: Under Function UpdateToc,
I added an extra item to become:
Function UpdateToc(TocEntry As String, dest As String, Rpt As Report)

where TocEntry is customer code, dest is the ship-to destination for each
customer.

The original code from http://support.microsoft.com/?id=210269 is:

Function UpdateToc(TocEntry As String, dest As String, Rpt As Report)
'Call from the OnPrint property of the section containing
'the Table Of Contents Description field.
'Updates the Table Of Contents table.
TocTable.Seek "=", TocEntry

If TocTable.NoMatch Then
TocTable.AddNew
TocTable!Description = TocEntry
TocTable![dest] = dest
TocTable![page number] = intPageCounter
TocTable.Update
End If

End Function

The above code will only record the 1st ship-to destination for each
customer. I need all the ship-to for each customer. I know its due to
TocTable.NoMatch -- since the customer code is the same, just the ship-to
is different, the remaining ship-to will not be recorded.

How do I add in dest to 'TocTable.Seek "=", TocEntry'?
 
D

Douglas J. Steele

If you're trying to create a Table Of Contents on the value of dest, that's
what should be in TocEntry in your call to UpdateToc, so you shouldn't to
pass it separately.

What Header sections have you defined for your report? In which header's
OnPrint event are you putting the call to UpdateToc?

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Elsie said:
hi, think I got the hang of it... except for this: Under Function UpdateToc,
I added an extra item to become:
Function UpdateToc(TocEntry As String, dest As String, Rpt As Report)

where TocEntry is customer code, dest is the ship-to destination for each
customer.

The original code from http://support.microsoft.com/?id=210269 is:

Function UpdateToc(TocEntry As String, dest As String, Rpt As Report)
'Call from the OnPrint property of the section containing
'the Table Of Contents Description field.
'Updates the Table Of Contents table.
TocTable.Seek "=", TocEntry

If TocTable.NoMatch Then
TocTable.AddNew
TocTable!Description = TocEntry
TocTable![dest] = dest
TocTable![page number] = intPageCounter
TocTable.Update
End If

End Function

The above code will only record the 1st ship-to destination for each
customer. I need all the ship-to for each customer. I know its due to
TocTable.NoMatch -- since the customer code is the same, just the ship-to
is different, the remaining ship-to will not be recorded.

How do I add in dest to 'TocTable.Seek "=", TocEntry'?


Elsie said:
hi, I followed the instructions but don't quite understand this part:
'Make sure the Description field is the same data type as the field that is
on your report that you use as a table-of-contents heading.'

for my situation, I have to print table of contents for each ship-to
destination for each customer. do I need to modify any part of the code from
that url?
if
 
E

Elsie

TocEntry is the customer code, dest is the customer name. so I need both.
I have report header, page header, SDC header, SMN header, product-code
footer, SMN footer, SMN footer, SDC footer, DTE footer, page footer, report
footer.

perhaps it would be better if you can refer to the attachment from my 1st
post, it contains a screenshot showing the design.

SDC: customer code
CNM: customer name
SMN: country
product-code: product category
DTE: current month (to sum up all qty and amt for current month)

Limitations:

1) for ship-to destination ONLY, customer name is same as country . e.g.: if
customer A ships to Belgium, CNM=SMN=Belgium. if a customer has only bill-to
address, then the CNM<>SMN

2) as some customers have more than 1 currency, I can't use the name alone.
for e.g.: customer A trades in USD & YEN -- U00000A & Y00000A are the
corresponding customer codes.

3) sometimes, different customers have same ship-to destination, e.g.:
U00000A and U00000B have Belgium as the ship-to destination.

I place the UpdateToc at page header. I realize that without anything in SDC
& SMN headers, the Table Of Contents table will not get updated. thus, at
page header's OnPrint event I put '=UpdateToc([SDC],[CNM],[Report])' and
change the call to UpdateToc to become Function UpdateToc(TocEntry As
String, dest As String, Rpt As Report).

my objective is to print a table of contents showing customer name, ship-to
destination and page number. think it would be better to use customer code
as the index.

please advise.



Douglas J. Steele said:
If you're trying to create a Table Of Contents on the value of dest, that's
what should be in TocEntry in your call to UpdateToc, so you shouldn't to
pass it separately.

What Header sections have you defined for your report? In which header's
OnPrint event are you putting the call to UpdateToc?

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Elsie said:
hi, think I got the hang of it... except for this: Under Function UpdateToc,
I added an extra item to become:
Function UpdateToc(TocEntry As String, dest As String, Rpt As Report)

where TocEntry is customer code, dest is the ship-to destination for each
customer.

The original code from http://support.microsoft.com/?id=210269 is:

Function UpdateToc(TocEntry As String, dest As String, Rpt As Report)
'Call from the OnPrint property of the section containing
'the Table Of Contents Description field.
'Updates the Table Of Contents table.
TocTable.Seek "=", TocEntry

If TocTable.NoMatch Then
TocTable.AddNew
TocTable!Description = TocEntry
TocTable![dest] = dest
TocTable![page number] = intPageCounter
TocTable.Update
End If

End Function

The above code will only record the 1st ship-to destination for each
customer. I need all the ship-to for each customer. I know its due to
TocTable.NoMatch -- since the customer code is the same, just the ship-to
is different, the remaining ship-to will not be recorded.

How do I add in dest to 'TocTable.Seek "=", TocEntry'?


Elsie said:
hi, I followed the instructions but don't quite understand this part:
'Make sure the Description field is the same data type as the field
that
is
on your report that you use as a table-of-contents heading.'

for my situation, I have to print table of contents for each ship-to
destination for each customer. do I need to modify any part of the
code
from
that url?


Please don't post attachments: none of the regulars are going to
take
the
chance of opening it.

To create a table of contents in a report, check out
http://support.microsoft.com/?id=210269

--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


hi all, I have a report which is printing a page for each
customer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top