473,748 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table of Contents stopped working (MDB -> ADP)

I have a report laid out in Design View as shown at the end of this message.

I have code that performs the following steps:

1. In main report's Report_Open(), DELETE any old rows in tblTOC for
this username.
2. In main report's CategoryHeader_ Format(), add a row to tblTOC with
the current category name and the current page number.
3. In the table of contents subreport, Cancel if NoData event fires.

When this report was in an MDB file, if Text12 had the datasource =
"[Page] of [Pages]" the report would run through the code for all the
data and properly fill in tblTOC with page numbers each time the
CategoryHeader_ Format() event fired. So that when the page with
FormVersionHead er on it was viewed, the table of contents would be
properly displayed.

I upsized this database to a SQL server backend / ADP front end and now
the page with FormVersionHead er on it is blank. My assumption is that
the report cancels the first time through because tblTOC is blank.
However, in the MDB file, once the report was open in preview mode, the
table of contents would get filled in the second time you navigated to
the page with FormVersionHead er on it. This second rendering doesn't
seem to be happening in the ADP file. Does anyone have any suggestions
on why this might occur?

Code snippets:

rptMain:

Private Sub Report_Open(Can cel as Integer)
' Setup the table of contents
If UCase(Me.ShowTO C.Caption) <> "Y" Then
With Me
.Text12.Control Source = "=""Page "" & [Page]"
.grpFormVersion Header.Visible = False
End With
Else
With Me
.Text12.Control Source = "=""Page "" & [Page] & "" of "" & [Pages]"
.grpFormVersion Header.Visible = True
End With

' Clear out old table of contents
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnecti on = Application.Cur rentProject.Con nection
.CommandType = adCmdText
.CommandText = "DELETE FROM " & sTOC_TABLE & " WHERE
Username='" & sUsername & "'"
.Execute
End With
Set cmd = Nothing
End If

End Sub

Private Sub grpCategoryHead er_Format(Cance l As Integer, FormatCount As
Integer)

' Update the table of contents, if necessary
If UCase(Me.ShowTO C.Caption) = "Y" Then
AddToTOC sTOC_TABLE, sUsername, CStr(Me.txtCate goryHeader),
CLng(Me.Page)
End If

End Sub

Public Sub AddToTOC(sTocTa ble As String, sUsername As String, sText As
String, lPageNumber As Long)

Dim rs As ADODB.Recordset
Dim sTableEntry As String

Set rs = New ADODB.Recordset
With rs

Set .ActiveConnecti on = Application.Cur rentProject.Con nection
.CursorType = adOpenKeyset
.LockType = adLockOptimisti c

.Open "SELECT * FROM " & sTocTable & " WHERE Username='" &
sUsername & "'"

' Save category name
sTableEntry = Mid(Trim(sText) , 1, .Fields("TableE ntry").DefinedS ize)
.Filter = "TableEntry ='" & sTableEntry & "'"

' If we haven't stored the pagenumber yet, save it to the table
If .RecordCount = 0 Then
.AddNew
.Fields("TableE ntry").Value = sTableEntry
.Fields("PageNu mber").Value = lPageNumber
.Fields("Userna me").Value = sUsername
.Update
End If

.Filter = adFilterNone
.Close
End With
Set rs = Nothing
End Sub

rptTOC:

Private Sub Report_NoData(C ancel As Integer)
Cancel = CInt(True)
End Sub

Report layout:

ReportHeader - acts as a cover sheet
------------
Label1 - datestamp
Label2 - database path

FormVersionHead er (FormVersion is a date stamp, all records in
recordsource have the same value)
---------

Subreport1 - based on the table of contents report, which is based on
the table, tblTOC.

CategoryHeader
---------------
Textbox1 - Displays category name in bold

ItemHeader
----------
Textbox2 - Item name
Textbox3 - Item description

Detail
------
contains several subreports that show details about the item

PageFooter
----------

Textbox12 - contains the page number info
Jan 12 '06 #1
1 2191
I've been fiddling around with the table of contents some more.
It still does not show up in the print preview, but when the data is
finally printed, the table shows up.

The only thing I can figure is that an ADP file will cache table data to
cut down on network traffic. Some the main report opens up, then the
table of contents sub-report is opened and its data is pulled. However,
since we just opened the main report, the recordsource for the subreport
is empty. Then after the report has finished loading in print preview,
the data is not fetched again when I navigate to page 2 (which is the
page with the table of contents on it). In the MDB file, the data for a
page is fetched everytime you navigate to it (or at least more
frequently) than it is in an ADP file.

Beowulf wrote:
I have a report laid out in Design View as shown at the end of this
message.

I have code that performs the following steps:

1. In main report's Report_Open(), DELETE any old rows in tblTOC for
this username.
2. In main report's CategoryHeader_ Format(), add a row to tblTOC with
the current category name and the current page number.
3. In the table of contents subreport, Cancel if NoData event fires.

When this report was in an MDB file, if Text12 had the datasource =
"[Page] of [Pages]" the report would run through the code for all the
data and properly fill in tblTOC with page numbers each time the
CategoryHeader_ Format() event fired. So that when the page with
FormVersionHead er on it was viewed, the table of contents would be
properly displayed.

I upsized this database to a SQL server backend / ADP front end and now
the page with FormVersionHead er on it is blank. My assumption is that
the report cancels the first time through because tblTOC is blank.
However, in the MDB file, once the report was open in preview mode, the
table of contents would get filled in the second time you navigated to
the page with FormVersionHead er on it. This second rendering doesn't
seem to be happening in the ADP file. Does anyone have any suggestions
on why this might occur?

Code snippets:

rptMain:

Private Sub Report_Open(Can cel as Integer)
' Setup the table of contents
If UCase(Me.ShowTO C.Caption) <> "Y" Then
With Me
.Text12.Control Source = "=""Page "" & [Page]"
.grpFormVersion Header.Visible = False
End With
Else
With Me
.Text12.Control Source = "=""Page "" & [Page] & "" of "" & [Pages]"
.grpFormVersion Header.Visible = True
End With

' Clear out old table of contents
Set cmd = New ADODB.Command
With cmd
Set .ActiveConnecti on = Application.Cur rentProject.Con nection
.CommandType = adCmdText
.CommandText = "DELETE FROM " & sTOC_TABLE & " WHERE Username='"
& sUsername & "'"
.Execute
End With
Set cmd = Nothing
End If

End Sub

Private Sub grpCategoryHead er_Format(Cance l As Integer, FormatCount As
Integer)

' Update the table of contents, if necessary
If UCase(Me.ShowTO C.Caption) = "Y" Then
AddToTOC sTOC_TABLE, sUsername, CStr(Me.txtCate goryHeader),
CLng(Me.Page)
End If

End Sub

Public Sub AddToTOC(sTocTa ble As String, sUsername As String, sText As
String, lPageNumber As Long)

Dim rs As ADODB.Recordset
Dim sTableEntry As String

Set rs = New ADODB.Recordset
With rs

Set .ActiveConnecti on = Application.Cur rentProject.Con nection
.CursorType = adOpenKeyset
.LockType = adLockOptimisti c

.Open "SELECT * FROM " & sTocTable & " WHERE Username='" & sUsername
& "'"

' Save category name
sTableEntry = Mid(Trim(sText) , 1, .Fields("TableE ntry").DefinedS ize)
.Filter = "TableEntry ='" & sTableEntry & "'"

' If we haven't stored the pagenumber yet, save it to the table
If .RecordCount = 0 Then
.AddNew
.Fields("TableE ntry").Value = sTableEntry
.Fields("PageNu mber").Value = lPageNumber
.Fields("Userna me").Value = sUsername
.Update
End If

.Filter = adFilterNone
.Close
End With
Set rs = Nothing
End Sub

rptTOC:

Private Sub Report_NoData(C ancel As Integer)
Cancel = CInt(True)
End Sub

Report layout:

ReportHeader - acts as a cover sheet
------------
Label1 - datestamp
Label2 - database path

FormVersionHead er (FormVersion is a date stamp, all records in
recordsource have the same value)
---------

Subreport1 - based on the table of contents report, which is based on
the table, tblTOC.

CategoryHeader
---------------
Textbox1 - Displays category name in bold

ItemHeader
----------
Textbox2 - Item name
Textbox3 - Item description

Detail
------
contains several subreports that show details about the item

PageFooter
----------

Textbox12 - contains the page number info

Jan 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1775
by: Steve_EE | last post by:
I'm running phpMyAdmin 2.5.3 / MySQL 4.0.14 / PHP 4.3.3 / Apache 1.3.20 phpMyAdmin is installed and appears ok at first, I can login, select databases, view which tables are in each db, see the exact structure of each table, but when I do anything that requires reading of the table contents - browse / select / etc - nothing. If I try browsing a table, the page gets rendered as far as the "Insert" tab along the top, then nothing more. If...
10
15199
by: tHatDudeUK | last post by:
My form action code to submit values to itself have stopped working using the code form action = <?=$_SERVER?> This code used to work My web host recently told me they enabled phpsuexec option in apache which apparently needs me to CHMOD my PHP page to 750 and the directory to 755. (I don't know what this means but know how to CHMOD files). I have CHMODed the
5
24147
by: Bill | last post by:
I used to be able to run the following ASP code on our corp machine (W2K Server Edition and IIS-5) and successfully send a net-msg to anyone on our intranet. Last week it stopped working... and I'm not sure what changed. (I had applied ALL the W2K update patches... but... I'm not sure if the problem started before or after that.) Did any recent W2K patches change the way createObject, wScript.shell, or "NET SEND" works?
4
2577
by: Dag Sunde | last post by:
I've been working on a system that have been running for the last couple of years, but stopped working on my dev. machine after reinstalling WinXP yesterday. To my knowledge, it have been set up with the same version of tools as I've always used. The following function does not call .clearTable() anymore. (That is... typeof document.getElementById('bidApplet').clearTable
2
2089
by: Dag Sunde | last post by:
I have the following code fragment in one of my pages: if (typeof document.getElementById('myApplet').getTableAsSDV != 'undefined') { rowBuffer = document.getElementById('myApplet').getTableAsSDV(); } The code above have been working in IE, NS anf Firefox for a long time now, but have suddenly stopped working in IE 6, on WIN XP SP1.
7
497
by: brett valjalo | last post by:
Hey Folks: Long time no see! Hope everyone is well. I have an old mdb I'm upsizing to an adp. There is a button on a form which executes code similar to the following (this is a search form where sql is dynamically generated based on 1-7 criteria fields chosen by the user): strSQL = strSQLBase & strWhere & strOrder
1
2817
by: Mark | last post by:
Hi - on my site, overnight, my submit buttons have suddenly stopped working in IE. Firefox is fine. The link button works perfectly - the two submit buttons however do not. It works in IE locally - can anyone please advise what may be wrong? Thanks, Mark ASPX:
1
4136
by: rickcasey | last post by:
I wonder if anyone has experienced something like this, as it seems truly bizarre and is causing me to tear out my hair (what little there is left of it).... The exec() function just suddenly stopped working, for no discernable reason. Here is the code: $execdir = $homedirectory."/".$genename."/".$rundir; // Run the Python script on the Exported text file(s).
2
1990
by: jkych | last post by:
Hi, A sample code as below: Private Sub codetesting() Dim rs As DAO.Database Set rs = CurrentDb MsgBox (rs.Name) End Sub
0
8983
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6792
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4592
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.