Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / March 2008

Tip: Looking for answers? Try searching our database.

Snaking Column Headers

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
poucedeleon - 29 Mar 2008 22:47 GMT
I am trying to use some code from Allen Browne that adds column headers to
your snaking column in a report. I am not sure where to put the line below
surrounded by astrist. I tried to put it in the general area of the form code
but that would not work. Can someone give me some advise.
To get a snaking column header above each column but only if the column has
data in it do the following:

Say you have two fields in the snaking column in the detail section of your
report. ITEM and CARRYING.

Create two unbound fields in the detail section and name them ITEM HEADER and
CARRYING HEADER. Align them above the matching field getting just the way you
want them (at the top of the detail section).Set their properties to be:

Can grow: Yes

Visible: Yes

Height:

0.0007 in.Now move the actual fields up just underneath the now very skinny
headers.
In the properties for the detail section add an event procedure to the On
Format. In it put the following code:

Sub Detail1_Format (Cancel As Integer, FormatCount As Integer)

If Me.left <> dLastLeft Then

Me![ITEM HEADER] = "Item"

Me![CARRYING HEADER] = "Carrying"

dLastLeft = Me.left

sItem = Me![ITEM]

Else

If sItem = Me![ITEM] Then

Me![ITEM HEADER] = "Item"

Me![CARRYING HEADER] = "Carrying"

Else

Me![ITEM HEADER] = ""

Me![CARRYING HEADER] = ""

End If

End If

End Sub
Set up the fields dLastLeft and sItem in any module in the general section:

*Global dLastLeft As DoubleGlobal, sItem As String*

Compile and save the module.
Evi - 30 Mar 2008 16:19 GMT
Just under the lines at the very top of the code page which say stuff like
Option Compare Database
Option Explicit

Evi

> I am trying to use some code from Allen Browne that adds column headers to
> your snaking column in a report. I am not sure where to put the line below
[quoted text clipped - 61 lines]
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200803/1
poucedeleon - 31 Mar 2008 03:25 GMT
When I enter the line in the general section it won't compile and I get the
following message,

"Constants, fixed-length strings, arrays, user-defined types and Declare
statements not allowed as Public members of module"

When I remove the word "Global it compiles but I get the following error:

"Statement invalid outside Type block"

>Just under the lines at the very top of the code page which say stuff like
>Option Compare Database
[quoted text clipped - 7 lines]
>> Message posted via AccessMonster.com
>> http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200803/1
Evi - 31 Mar 2008 11:27 GMT
I'm wondering if the DoubleGlobal thing is a typo. Can't find any trace of
it in Access 2000
Evi

> When I enter the line in the general section it won't compile and I get the
> following message,
[quoted text clipped - 21 lines]
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200803/1
Evi - 31 Mar 2008 18:12 GMT
Your quite right. It's really confusing! I'd never tried it out before. Lets
see if we can make it a bit clearer.

So you put 2 unbound text boxes in the Details section in your multi-column
report and name them ItemHeader and CarryingHeader , 1 above each field
which you want to label. You make their height .0007 and set their Can Grow
property to Yes and their Visible Property to Yes.
The code assumes that you want the word Item to appear in ItemHeader and
Price in CarryingHeader.
It assumes that you have a field called Item
(that's the Me![Item] bit)

This is what you'll see on the report's code page

Option Compare Database
Option Explicit

Dim dLastLeft As Double
Dim sItem As String
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If Me.Left <> dLastLeft Then
          Me![ItemHeader] = "Item"
          Me![CarryingHeader] = "Price"
          dLastLeft = Me.Left
          sItem = Me![Item]
       Else
          If sItem = Me![Item] Then
             Me![ItemHeader] = "Item"
             Me![CarryingHeader] = "Price"
          Else
             Me![ItemHeader] = ""
             Me![CarryingHeader] = ""
          End If
       End If
   End Sub

You'll see that I haven't used the word Global at all but I've put the two
dims at the top of the code page (There should have been a line break
between Double and Global in the text) I've changed the field and label
names to fit my own db but let me know if that causes confusion
I couldn't tell you why it works but if the Dims for DLastLeft and sItem are
but *under* the Private Sub bit you get a header over every item.
Evi

> I'm wondering if the DoubleGlobal thing is a typo. Can't find any trace of
> it in Access 2000
[quoted text clipped - 29 lines]
> > Message posted via AccessMonster.com
> > http://www.accessmonster.com/Uwe/Forums.aspx/access-reports/200803/1
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.