Very small bitmap graphic as picture object on report - how to set visible property on Format event?

Very small bitmap graphic as picture object on report - how to set visible property on Format event?

am 07.01.2008 22:29:59 von MLH

I have a small bitmap graphic on a report.
I would like to set it's Visible property to True
whe the value of a certain field on the report
is True. Can I do that? I have tried in the
OnFormat event code...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me!ThreeBucks = True Then Me!ThreeDollarRansomNote.Visible = True
Else Me!ThreeDollarRansomNote.Visible = False

End Sub
(watch out for word-wrap)

But that fails. Suggestions?

Re: Very small bitmap graphic as picture object on report - how to

am 07.01.2008 23:39:16 von laurenq uantrell

You must put this in the OnFormat of the Detail section of the report:

Private Sub Detail_Format(cancel As Integer, FormatCount As Integer)
On Error GoTo myErr

'>set icon:
If Len(Me!myDataName) > 0 Then
Me.ImageName.Visible = True
Else
Me.ImageName.Visible = False
End If

myExit:
Exit Sub
myErr:
MsgBox Err.Number & "-" & Err.Description
Resume myExit
End Sub

Re: Very small bitmap graphic as picture object on report - how to set visible property on Format ev

am 08.01.2008 01:24:47 von fredg

On Mon, 07 Jan 2008 16:29:59 -0500, MLH wrote:

> I have a small bitmap graphic on a report.
> I would like to set it's Visible property to True
> whe the value of a certain field on the report
> is True. Can I do that? I have tried in the
> OnFormat event code...
>
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> If Me!ThreeBucks = True Then Me!ThreeDollarRansomNote.Visible = True
> Else Me!ThreeDollarRansomNote.Visible = False
>
> End Sub
> (watch out for word-wrap)
>
> But that fails. Suggestions?

At the very least you are missing an End If.

Try it this way.

Assuming ThreeRansomNote is the name of the Image Control, and
ThreeBucks is the name of your True/False control (and it is a Boolean
control not text) .....

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me!ThreeDollarRansomNote.Visible = Me!ThreeBucks
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Re: Very small bitmap graphic as picture object on report - how to set visible property on Format e

am 08.01.2008 01:45:57 von MLH

I tried it again - this time I made sure the query upon
which the report was based returned some records.
It worked then. Your suggestion looks like it too
would work.

I'm a bit surprised at the error I was getting being a
2427 error: "You entered an expression that has no
value". If the report object's recordsource produces
no records, the Format event is still occuring. The
OnFormat code is running - that's what's producing
the error. But what's so wrong with the expression
that this error occurs when no records are returned?

Even if I change the problem line to read...

If Nz(Me!ThreeBucks, 0) = True Then Me!ThreeDollarRansomNote.Visible =
True Else Me!ThreeDollarRansomNote.Visible = False

.... I still get the same error! What's with that? So what?
The value in the damned textbox ain't True, it ain't False
and it apparently ain't Null either. Otherwise - why would
Access report this error?

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


On Mon, 7 Jan 2008 14:39:16 -0800 (PST), Lauren Quantrell
wrote:

>You must put this in the OnFormat of the Detail section of the report:
>
>Private Sub Detail_Format(cancel As Integer, FormatCount As Integer)
>On Error GoTo myErr
>
> '>set icon:
> If Len(Me!myDataName) > 0 Then
> Me.ImageName.Visible = True
> Else
> Me.ImageName.Visible = False
> End If
>
>myExit:
> Exit Sub
>myErr:
> MsgBox Err.Number & "-" & Err.Description
> Resume myExit
>End Sub

Re: Very small bitmap graphic as picture object on report - how to set visible property on Format ev

am 08.01.2008 01:50:20 von MLH

Naw. That's not it. The 'word wrap' confused you. The if-then-else
is all on 1 line. That compiles fine. The error returned is a 2427
that I experienced when the RecordSource query returned NO
records. When it returns records, the small graphic displays on
some pages and not others - exactly as intended. The error has
me baffled. I'm getting it in A97. But it may be the case in advanced
versions as well, dunno.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


On Mon, 7 Jan 2008 16:24:47 -0800, fredg
wrote:

>On Mon, 07 Jan 2008 16:29:59 -0500, MLH wrote:
>
>> I have a small bitmap graphic on a report.
>> I would like to set it's Visible property to True
>> whe the value of a certain field on the report
>> is True. Can I do that? I have tried in the
>> OnFormat event code...
>>
>> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
>> If Me!ThreeBucks = True Then Me!ThreeDollarRansomNote.Visible = True
>> Else Me!ThreeDollarRansomNote.Visible = False
>>
>> End Sub
>> (watch out for word-wrap)
>>
>> But that fails. Suggestions?
>
>At the very least you are missing an End If.
>
>Try it this way.
>
>Assuming ThreeRansomNote is the name of the Image Control, and
>ThreeBucks is the name of your True/False control (and it is a Boolean
>control not text) .....
>
>Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
>Me!ThreeDollarRansomNote.Visible = Me!ThreeBucks
>End Sub

Re: Very small bitmap graphic as picture object on report - how to

am 08.01.2008 14:33:56 von Keith Tizzard

On Jan 7, 9:29=A0pm, MLH wrote:
> I have a small bitmap graphic on a report.
> I would like to set it's Visible property to True
> whe the value of a certain field on the report
> is True. Can I do that? I have tried in the
> OnFormat event code...
>
> Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
> If Me!ThreeBucks =3D True Then Me!ThreeDollarRansomNote.Visible =3D True
> Else Me!ThreeDollarRansomNote.Visible =3D False
>
> End Sub
> (watch out for word-wrap)
>
> But that fails. Suggestions?

How about
Me!ThreeDollarRansomNote.Visible =3D me!ThreeBucks

Looks simpler. Does the same job

Jim

Re: Very small bitmap graphic as picture object on report - how to set visible property on Format e

am 10.01.2008 09:39:45 von MLH


I like that!
Thanks.

>
>How about
>Me!ThreeDollarRansomNote.Visible = me!ThreeBucks
>
>Looks simpler. Does the same job
>
>Jim