From: 1stAyd on
Greetings, Access Novice here.

I have Line18 formatted as Visible = "NO" in Properties, and I want to make
it visible depending on the value of certain fields. Why doesn't this code
work when put in the "On Format" or "On Print" events of the Detail section?

If [Inventory Posting Group] = "RESALE" Then Line18.Visible = "YES"

BTW, I tried "TRUE" in place of "YES", and it still didn't work. TIA.

From: Duane Hookom on
Assuming [Inventory Posting Group] is bound to a control in the report, you
should be able to use:
ME.Line18.Visible = (Me.[Inventory Posting Group] = "RESALE")

--
Duane Hookom
Microsoft Access MVP


"1stAyd" wrote:

> Greetings, Access Novice here.
>
> I have Line18 formatted as Visible = "NO" in Properties, and I want to make
> it visible depending on the value of certain fields. Why doesn't this code
> work when put in the "On Format" or "On Print" events of the Detail section?
>
> If [Inventory Posting Group] = "RESALE" Then Line18.Visible = "YES"
>
> BTW, I tried "TRUE" in place of "YES", and it still didn't work. TIA.
>
> .
>
From: 1stAyd on
I tried that too, but didn't realize [Inventory Posting Group] had to be tied
to a report control. It's currently just on my source query. I'll try it
tomorrow and report back. Thanks!


Duane Hookom wrote:
>Assuming [Inventory Posting Group] is bound to a control in the report, you
>should be able to use:
> ME.Line18.Visible = (Me.[Inventory Posting Group] = "RESALE")
>
>> Greetings, Access Novice here.
>>
>[quoted text clipped - 7 lines]
>>
>> .

From: fredg on
On Thu, 13 May 2010 20:28:14 GMT, 1stAyd wrote:

> Greetings, Access Novice here.
>
> I have Line18 formatted as Visible = "NO" in Properties, and I want to make
> it visible depending on the value of certain fields. Why doesn't this code
> work when put in the "On Format" or "On Print" events of the Detail section?
>
> If [Inventory Posting Group] = "RESALE" Then Line18.Visible = "YES"
>
> BTW, I tried "TRUE" in place of "YES", and it still didn't work. TIA.

You've turned the Yes (no quotes) into "Yes" (a string value).
Anyway in VBA it should have been True (without the quotes) not Yes.
Yes is not a VBA constant. True is.

If [Inventory Posting Group] = "RESALE" Then Line18.Visible = True

A simpler expression would be:
Line18.Visible = [Inventory Posting Group] = "RESALE"

--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
From: 1stAyd via AccessMonster.com on
Still no luck. I created txtIPG, with the control source as [Inventory
Posting Group], and have this in the "On Format" event of the detail section:

=[Me].[Line18].[Visible]=([Me].[txtIPG]="RESALE")

I'm sure the answer will be something really simple.... TIA.


1stAyd wrote:
>I tried that too, but didn't realize [Inventory Posting Group] had to be tied
>to a report control.....

--
Message posted via http://www.accessmonster.com