Selectively Hiding Group Headers & Footers

  • Thread starter Thread starter Big Dog
  • Start date Start date
B

Big Dog

I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")
 
Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


Duane Hookom said:
You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
You need to open the module window for the event. Remove the value you placed
in the property and click the [...] button and go into the code window. Enter
the code there.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


Duane Hookom said:
You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
Got a different error.
this is what I typed: =[Cancel]=([Me].[Task Number]=" ")

this is the error message:
"the expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Cancel'.

thaks again
--
Bill Gable


Duane Hookom said:
You need to open the module window for the event. Remove the value you placed
in the property and click the [...] button and go into the code window. Enter
the code there.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


Duane Hookom said:
You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
Go back to my original reply and find out the code that should be entered.
Keep in mind that " " will only match a single space in the value of the
control. It will not match Null or "".

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Got a different error.
this is what I typed: =[Cancel]=([Me].[Task Number]=" ")

this is the error message:
"the expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Cancel'.

thaks again
--
Bill Gable


Duane Hookom said:
You need to open the module window for the event. Remove the value you placed
in the property and click the [...] button and go into the code window. Enter
the code there.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


:

You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
Duane:

this is what I entered in an attempt to replicate your message:

I get the following error message:
Deltek Advantage can't find the macro 'Cancel = (Me.'
The macro (or its macro group) doesn't exist. or the macro is new but hasn't
been saved.

Deltek Advantage is the database application, and I am using their Custom
Report Toolkit in Access to create this report.

Sorry for being so thick-headed.

Thanks
--
Bill Gable


Duane Hookom said:
Go back to my original reply and find out the code that should be entered.
Keep in mind that " " will only match a single space in the value of the
control. It will not match Null or "".

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Got a different error.
this is what I typed: =[Cancel]=([Me].[Task Number]=" ")

this is the error message:
"the expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Cancel'.

thaks again
--
Bill Gable


Duane Hookom said:
You need to open the module window for the event. Remove the value you placed
in the property and click the [...] button and go into the code window. Enter
the code there.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


:

You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
Again, this code is not entered into the property dialog box. It is entered
into the module. The event property should display [Event Procedure].
Clicking the builder button [...] to the right of the property should open
the Visual Basic Code window. This is how your finished code might look
(depending on your section and control names):

Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
Cancel = (Me.[Specific Bound Field] = "Some Value")
End Sub

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Duane:

this is what I entered in an attempt to replicate your message:

I get the following error message:
Deltek Advantage can't find the macro 'Cancel = (Me.'
The macro (or its macro group) doesn't exist. or the macro is new but hasn't
been saved.

Deltek Advantage is the database application, and I am using their Custom
Report Toolkit in Access to create this report.

Sorry for being so thick-headed.

Thanks
--
Bill Gable


Duane Hookom said:
Go back to my original reply and find out the code that should be entered.
Keep in mind that " " will only match a single space in the value of the
control. It will not match Null or "".

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Got a different error.
this is what I typed: =[Cancel]=([Me].[Task Number]=" ")

this is the error message:
"the expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Cancel'.

thaks again
--
Bill Gable


:

You need to open the module window for the event. Remove the value you placed
in the property and click the [...] button and go into the code window. Enter
the code there.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


:

You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
thanks, that did it.
--
Bill Gable


Duane Hookom said:
Again, this code is not entered into the property dialog box. It is entered
into the module. The event property should display [Event Procedure].
Clicking the builder button [...] to the right of the property should open
the Visual Basic Code window. This is how your finished code might look
(depending on your section and control names):

Private Sub GroupHeader2_Format(Cancel As Integer, FormatCount As Integer)
Cancel = (Me.[Specific Bound Field] = "Some Value")
End Sub

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


Big Dog said:
Duane:

this is what I entered in an attempt to replicate your message:

I get the following error message:
Deltek Advantage can't find the macro 'Cancel = (Me.'
The macro (or its macro group) doesn't exist. or the macro is new but hasn't
been saved.

Deltek Advantage is the database application, and I am using their Custom
Report Toolkit in Access to create this report.

Sorry for being so thick-headed.

Thanks
--
Bill Gable


Duane Hookom said:
Go back to my original reply and find out the code that should be entered.
Keep in mind that " " will only match a single space in the value of the
control. It will not match Null or "".

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

Got a different error.
this is what I typed: =[Cancel]=([Me].[Task Number]=" ")

this is the error message:
"the expression On Format you entered as the event property setting produced
the following error: The object doesn't contain the Automation object
'Cancel'.

thaks again
--
Bill Gable


:

You need to open the module window for the event. Remove the value you placed
in the property and click the [...] button and go into the code window. Enter
the code there.

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

Duane:

there's a good chance that I didn't do this correctly.
what I did was enter this code into the "On Format" field on the "Event" tab
of the properties dialogue bax for the group header section that I am trying
to "hide". I changed the [Specific Bound Field] to the filed name being
tested as it appears in the "Field List" for the report.

When I generate the report I get an error message (paraphrased) stating that
"it can't find the macro 'Cancel=(Me.' " followed by an explanation that "The
macro (or its macro group) doesn't exist, or the macro is new but hasn't been
saved..."

No clue about this, though I am somewhat familiar with macros in non-Access
Office applications.

Thanks
--
Bill Gable


:

You might be able to add code to the On Format event of your section like:
Cancel = (Me.[Specific Bound Field] = "Some Value")

--
Duane Hookom
Microsoft Access MVP
If I have helped you, please help me by donating to UCP
http://www.access.hookom.net/UCP/Default.htm


:

I'd like to control the printing of group headers and footers based on the
value in a specific data field. Is this possible? Using Access 2003.
Thanks
 
I just wanted to thank Bill for asking this question and Duane Hookom for
answering. I used the answer to fix a problem I was having in a report with
3 grouping levels and it worked beautifully. Thank you so much!
 
Back
Top