473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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?
Jan 7 '08 #1
6 2622
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
Jan 7 '08 #2
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
Jan 8 '08 #3
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
<la*************@hotmail.comwrote:
>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
Jan 8 '08 #4
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 <fg******@example.invalid>
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
Jan 8 '08 #5
On Jan 7, 9:29*pm, MLH <C...@NorthState.netwrote:
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?
How about
Me!ThreeDollarRansomNote.Visible = me!ThreeBucks

Looks simpler. Does the same job

Jim
Jan 8 '08 #6
MLH
<snip>
I like that!
Thanks.
>
How about
Me!ThreeDollarRansomNote.Visible = me!ThreeBucks

Looks simpler. Does the same job

Jim
Jan 10 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: dixie | last post by:
I have a report with a subreport. The source object for this subreport varies according to the value of a field in a table. I am trying to programmatically set the object source for the subreport...
3
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
5
by: Erwin | last post by:
At the moment I'm using a report which contains an indicator to show if a Service group of the company isn't working well or is working perfectly. This indicator is a "*" which looks like a traffic...
6
by: charsh | last post by:
Hi, I using the code below to draw a text in a pictureBox1. //Start--------------------------------------------------------------- private void button1_Click(object sender, System.EventArgs e)...
12
by: BC | last post by:
Hello, We are creating an Office add-in. We are able to display the add-in successfully. However, we followed a sample program, and it displays a FaceID = 1044 (which is not the bitmap of the...
8
by: Paul Loveless | last post by:
Hi all, I've written the following code to retrieve the file format of an image file: Dim objImageFormat As ImageFormat objImageFormat = Me.SourceImage.RawFormat If...
6
by: Lespaul36 | last post by:
From what I have read, there isn't really a converter to icon format..it becomes a png file. I tried: 1: Dim bmp As Bitmap = CType(Bitmap.FromFile("C:\myfolder\file.bmp"), Bitmap) 2: ...
4
by: Rico | last post by:
Hello, I'm looking for a way to force a pagebreak in code. I'm having a tough time, the first page formats properly until the condition is met and then forces a new page. The problem is, every...
7
by: RB0135 | last post by:
Hi All, I have some Windows BMP, 1BPP, monochrome files that I need to get the raw data from to load a graphics buffer on a Roll Printer (which I know can be done). Lets forget about the Roll...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.