Problem with Can Shrink/Grow

W

winsa

Hi

I have tried everything to get a GroupFooter section on my report to shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if certain
criteria are met (via Print event). When the criteria is met, the control
displays correctly. However, when the criteria isn't met, the control
doesn't display, which is what I want, but the rest of the report doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There are no
other controls to either side of the textbox. When the criteria for
displaying the control is not met, the control is set to NULL. Is this a
problem?

My other question is, does the CanShrink/Grow properties be made to work
with labels?

Thanks
winsa
 
A

Allen Browne

Any chance of moving the code into the Format event of the section, instead
of the print event? That would give Access time to plot the shrinking.

Labels cannot shrink, but you can easily replace them with a text box. For
example, if you only want the label to display when the City text box has a
value in it, use a text box as the "label", and set its Control Source to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.
 
W

winsa

Hi Allen

Thanks for your reply. I tried putting the code in the Format event, but it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


Allen Browne said:
Any chance of moving the code into the Format event of the section, instead
of the print event? That would give Access time to plot the shrinking.

Labels cannot shrink, but you can easily replace them with a text box. For
example, if you only want the label to display when the City text box has a
value in it, use a text box as the "label", and set its Control Source to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
Hi

I have tried everything to get a GroupFooter section on my report to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if certain
criteria are met (via Print event). When the criteria is met, the control
displays correctly. However, when the criteria isn't met, the control
doesn't display, which is what I want, but the rest of the report doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There are no
other controls to either side of the textbox. When the criteria for
displaying the control is not met, the control is set to NULL. Is this a
problem?

My other question is, does the CanShrink/Grow properties be made to work
with labels?

Thanks
winsa
 
A

Allen Browne

Not sure what else to suggest.

Does is shrink if you remove the code completely?

Are you certain there is nothing else overlapping the control vertically at
all?

I also did not follow why IIf() would not work in the Control Source of the
control. Perhaps you could try:
=IIf(IsNull([City]), Null, "City:")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
Hi Allen

Thanks for your reply. I tried putting the code in the Format event, but
it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


Allen Browne said:
Any chance of moving the code into the Format event of the section,
instead
of the print event? That would give Access time to plot the shrinking.

Labels cannot shrink, but you can easily replace them with a text box.
For
example, if you only want the label to display when the City text box has
a
value in it, use a text box as the "label", and set its Control Source
to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

winsa said:
Hi

I have tried everything to get a GroupFooter section on my report to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if certain
criteria are met (via Print event). When the criteria is met, the
control
displays correctly. However, when the criteria isn't met, the control
doesn't display, which is what I want, but the rest of the report
doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There are
no
other controls to either side of the textbox. When the criteria for
displaying the control is not met, the control is set to NULL. Is this
a
problem?

My other question is, does the CanShrink/Grow properties be made to
work
with labels?

Thanks
winsa
 
W

winsa

Hi Allen

I thought I read somewhere that IIF doesn't work in an adp file, but it did
when I tried it after your suggestion! However, using the IIF function still
did not make the control and label disappear or the section shrink.

I entered the following in the control:

IIF(SRCODE="G", GST, Null)

With G as the parameter, then the control appears with the right data, but
with any other letter as a parameter, the control appears blank, but the
label also appears and the section does not shrink.

I have triple checked and there are no other controls to either side of it,
just the text box and its label.

I might have to just rearrange the invoice so that I can control it via
Visible in code rather than have the section move up and down depending on
the control.

Thanks
Winsa

Allen Browne said:
Not sure what else to suggest.

Does is shrink if you remove the code completely?

Are you certain there is nothing else overlapping the control vertically at
all?

I also did not follow why IIf() would not work in the Control Source of the
control. Perhaps you could try:
=IIf(IsNull([City]), Null, "City:")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
Hi Allen

Thanks for your reply. I tried putting the code in the Format event, but
it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


Allen Browne said:
Any chance of moving the code into the Format event of the section,
instead
of the print event? That would give Access time to plot the shrinking.

Labels cannot shrink, but you can easily replace them with a text box.
For
example, if you only want the label to display when the City text box has
a
value in it, use a text box as the "label", and set its Control Source
to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

Hi

I have tried everything to get a GroupFooter section on my report to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if certain
criteria are met (via Print event). When the criteria is met, the
control
displays correctly. However, when the criteria isn't met, the control
doesn't display, which is what I want, but the rest of the report
doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There are
no
other controls to either side of the textbox. When the criteria for
displaying the control is not met, the control is set to NULL. Is this
a
problem?

My other question is, does the CanShrink/Grow properties be made to
work
with labels?

Thanks
winsa
 
A

Allen Browne

Try setting the Control Source of the text box to:
=IIf([SRCODE]="G", "GST", Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
I thought I read somewhere that IIF doesn't work in an adp file, but it
did
when I tried it after your suggestion! However, using the IIF function
still
did not make the control and label disappear or the section shrink.

I entered the following in the control:

IIF(SRCODE="G", GST, Null)

With G as the parameter, then the control appears with the right data, but
with any other letter as a parameter, the control appears blank, but the
label also appears and the section does not shrink.

I have triple checked and there are no other controls to either side of
it,
just the text box and its label.

I might have to just rearrange the invoice so that I can control it via
Visible in code rather than have the section move up and down depending on
the control.

Thanks
Winsa

Allen Browne said:
Not sure what else to suggest.

Does is shrink if you remove the code completely?

Are you certain there is nothing else overlapping the control vertically
at
all?

I also did not follow why IIf() would not work in the Control Source of
the
control. Perhaps you could try:
=IIf(IsNull([City]), Null, "City:")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
Hi Allen

Thanks for your reply. I tried putting the code in the Format event,
but
it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As
Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


:

Any chance of moving the code into the Format event of the section,
instead
of the print event? That would give Access time to plot the shrinking.

Labels cannot shrink, but you can easily replace them with a text box.
For
example, if you only want the label to display when the City text box
has
a
value in it, use a text box as the "label", and set its Control Source
to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

Hi

I have tried everything to get a GroupFooter section on my report to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if certain
criteria are met (via Print event). When the criteria is met, the
control
displays correctly. However, when the criteria isn't met, the
control
doesn't display, which is what I want, but the rest of the report
doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There
are
no
other controls to either side of the textbox. When the criteria for
displaying the control is not met, the control is set to NULL. Is
this
a
problem?

My other question is, does the CanShrink/Grow properties be made to
work
with labels?
 
W

winsa

Hi Allen

GST is actually a field in my underlying query. I tried changing it to:

=IIf([SRCODE]="G", [PRM]*0.1, Null

But that didn't work either.

Any other ideas?

Winsa

Allen Browne said:
Try setting the Control Source of the text box to:
=IIf([SRCODE]="G", "GST", Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
I thought I read somewhere that IIF doesn't work in an adp file, but it
did
when I tried it after your suggestion! However, using the IIF function
still
did not make the control and label disappear or the section shrink.

I entered the following in the control:

IIF(SRCODE="G", GST, Null)

With G as the parameter, then the control appears with the right data, but
with any other letter as a parameter, the control appears blank, but the
label also appears and the section does not shrink.

I have triple checked and there are no other controls to either side of
it,
just the text box and its label.

I might have to just rearrange the invoice so that I can control it via
Visible in code rather than have the section move up and down depending on
the control.

Thanks
Winsa

Allen Browne said:
Not sure what else to suggest.

Does is shrink if you remove the code completely?

Are you certain there is nothing else overlapping the control vertically
at
all?

I also did not follow why IIf() would not work in the Control Source of
the
control. Perhaps you could try:
=IIf(IsNull([City]), Null, "City:")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thanks for your reply. I tried putting the code in the Format event,
but
it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As
Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


:

Any chance of moving the code into the Format event of the section,
instead
of the print event? That would give Access time to plot the shrinking.

Labels cannot shrink, but you can easily replace them with a text box.
For
example, if you only want the label to display when the City text box
has
a
value in it, use a text box as the "label", and set its Control Source
to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

Hi

I have tried everything to get a GroupFooter section on my report to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if certain
criteria are met (via Print event). When the criteria is met, the
control
displays correctly. However, when the criteria isn't met, the
control
doesn't display, which is what I want, but the rest of the report
doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There
are
no
other controls to either side of the textbox. When the criteria for
displaying the control is not met, the control is set to NULL. Is
this
a
problem?

My other question is, does the CanShrink/Grow properties be made to
work
with labels?
 
A

Allen Browne

You could test whether Access is actually understanding the value as a null
by temporarily using this as the Control Source:
=TypeName(IIf([SRCODE]="G", [GST], Null))
If you see the word Null where you expect it to be Null, then you have the
expression correct, so remove the TypeName() again.

If the result is still not shrinking, even though you have CanShrink set to
Yes for both the text box and the section, then remove any other controls
from the section. If it works, add the other controls back so they do not
overlap vertically at all (regardless of horizontal placement/overlap).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
Hi Allen

GST is actually a field in my underlying query. I tried changing it to:

=IIf([SRCODE]="G", [PRM]*0.1, Null

But that didn't work either.

Any other ideas?

Winsa

Allen Browne said:
Try setting the Control Source of the text box to:
=IIf([SRCODE]="G", "GST", Null)

winsa said:
I thought I read somewhere that IIF doesn't work in an adp file, but it
did
when I tried it after your suggestion! However, using the IIF function
still
did not make the control and label disappear or the section shrink.

I entered the following in the control:

IIF(SRCODE="G", GST, Null)

With G as the parameter, then the control appears with the right data,
but
with any other letter as a parameter, the control appears blank, but
the
label also appears and the section does not shrink.

I have triple checked and there are no other controls to either side of
it,
just the text box and its label.

I might have to just rearrange the invoice so that I can control it via
Visible in code rather than have the section move up and down depending
on
the control.

Thanks
Winsa

:

Not sure what else to suggest.

Does is shrink if you remove the code completely?

Are you certain there is nothing else overlapping the control
vertically
at
all?

I also did not follow why IIf() would not work in the Control Source
of
the
control. Perhaps you could try:
=IIf(IsNull([City]), Null, "City:")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thanks for your reply. I tried putting the code in the Format
event,
but
it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting
the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As
Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


:

Any chance of moving the code into the Format event of the section,
instead
of the print event? That would give Access time to plot the
shrinking.

Labels cannot shrink, but you can easily replace them with a text
box.
For
example, if you only want the label to display when the City text
box
has
a
value in it, use a text box as the "label", and set its Control
Source
to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

Hi

I have tried everything to get a GroupFooter section on my report
to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if
certain
criteria are met (via Print event). When the criteria is met,
the
control
displays correctly. However, when the criteria isn't met, the
control
doesn't display, which is what I want, but the rest of the report
doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There
are
no
other controls to either side of the textbox. When the criteria
for
displaying the control is not met, the control is set to NULL.
Is
this
a
problem?

My other question is, does the CanShrink/Grow properties be made
to
work
with labels?
 
W

winsa

Hi Allen

I did as you suggested with the =TypeName() and that worked, it did produce
a Null as expected.

I then removed all controls from the section and the section did shrink. I
then put all the controls back and made sure that they weren't overlapping
vertically. It worked!

However, when I added a label to the text box, it didn't work, so I guess
I'll have to leave the label out and just use the IIF function!

I also did notice that if I did have two controls overlapping vertically,
the shrinking did work too?

At the outset, I may have had too big a gap between the controls to actually
notice the shrinking. I have set the controls closer together now and the
section shrinks exactly as I want it to.

Thanks heaps for your all help!!

Regards
Winsa

Allen Browne said:
You could test whether Access is actually understanding the value as a null
by temporarily using this as the Control Source:
=TypeName(IIf([SRCODE]="G", [GST], Null))
If you see the word Null where you expect it to be Null, then you have the
expression correct, so remove the TypeName() again.

If the result is still not shrinking, even though you have CanShrink set to
Yes for both the text box and the section, then remove any other controls
from the section. If it works, add the other controls back so they do not
overlap vertically at all (regardless of horizontal placement/overlap).

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

winsa said:
Hi Allen

GST is actually a field in my underlying query. I tried changing it to:

=IIf([SRCODE]="G", [PRM]*0.1, Null

But that didn't work either.

Any other ideas?

Winsa

Allen Browne said:
Try setting the Control Source of the text box to:
=IIf([SRCODE]="G", "GST", Null)


I thought I read somewhere that IIF doesn't work in an adp file, but it
did
when I tried it after your suggestion! However, using the IIF function
still
did not make the control and label disappear or the section shrink.

I entered the following in the control:

IIF(SRCODE="G", GST, Null)

With G as the parameter, then the control appears with the right data,
but
with any other letter as a parameter, the control appears blank, but
the
label also appears and the section does not shrink.

I have triple checked and there are no other controls to either side of
it,
just the text box and its label.

I might have to just rearrange the invoice so that I can control it via
Visible in code rather than have the section move up and down depending
on
the control.

Thanks
Winsa

:

Not sure what else to suggest.

Does is shrink if you remove the code completely?

Are you certain there is nothing else overlapping the control
vertically
at
all?

I also did not follow why IIf() would not work in the Control Source
of
the
control. Perhaps you could try:
=IIf(IsNull([City]), Null, "City:")

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Hi Allen

Thanks for your reply. I tried putting the code in the Format
event,
but
it
still didn't work.

I can't use IIF because I'm working in an adp, and I tried setting
the
control via code, but that didn't seem to work either.

Here is my code if it's any help:

Private Sub GroupFooter2_Print(Cancel As Integer, PrintCount As
Integer)

Select Case SR_CODE
Case "N"
SR_PRM = N_PRM
GST.Visible = False
GST = ""

Case "H"
SR_PRM = H_PRM
GST.Visible = False
GST = ""

Case "S"
SR_PRM = S_PRM
GST.Visible = False
GST = ""

Case "G"
SR_PRM = G_PRM
GST = [N_PRM] * 0.1
GST.Visible = True
End Select
End Sub

Thanks
Winsa


:

Any chance of moving the code into the Format event of the section,
instead
of the print event? That would give Access time to plot the
shrinking.

Labels cannot shrink, but you can easily replace them with a text
box.
For
example, if you only want the label to display when the City text
box
has
a
value in it, use a text box as the "label", and set its Control
Source
to:
=IIf([City] Is Null, Null, "City:")
Because is is actually a text box, it Can Shrink.

Hi

I have tried everything to get a GroupFooter section on my report
to
shrink
if a textbox is empty, but I'm really not having any success.

The control is unbound, and is only populated and visible if
certain
criteria are met (via Print event). When the criteria is met,
the
control
displays correctly. However, when the criteria isn't met, the
control
doesn't display, which is what I want, but the rest of the report
doesn't
move up to close off the space and I'm left with a very big gap.

Does anybody have any idea what I'm doing wrong? I have set the
GroupFooter
Section, and the textbox CanShrink/Grow properties to Yes. There
are
no
other controls to either side of the textbox. When the criteria
for
displaying the control is not met, the control is set to NULL.
Is
this
a
problem?

My other question is, does the CanShrink/Grow properties be made
to
work
with labels?
 

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