visable

R

rml

I have a report with a graphic on it. I have the visable property to no.
I would like, on open, check if a field has the word "fails" in it to make
the graphic field visable. Here is what I have but it is not working. Any
help.

If Me!Results = "*fails*" Then Me!Image160.Visable = True

Thanks.
 
A

Allen Browne

1. Don't use the Open event of the Report.
Use the Format event of the section that contains the image.

2. Use the Like operator with the wildcard.

3. For efficiency, set the Visible property only if it needs to be changed.

Example:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim bShow As Boolean

If Me.Results Like "*fails*" Then
bShow = True
End If

If Me.image160.Visible <> bShow Then
Me.image160.Visible = bShow
End If
End Sub
 
A

Allen Browne

With the report open in design view, check these things:

1. Does this happen only if the report has no data to show?
If so, just include error handling to recover:
http://allenbrowne.com/ser-23a.html

2. At the top of the code window, make sure you have these 2 lines:
Option Compare Database
Option Explicit
Add the Option Explicit if it's not already there.
(This is very useful to identify names that are incorrect.)

3. Try Compile on the Debug menu (in the code window).
Fix any errors that show, and repeat until you find the Debug option dimmed
out on the menu.

4. Locate the control named Results. Is it something that has a value (such
as a text box)? Or something that has no Value property (such as a label)?
 
R

rml

Looks like the error only occurs when no data is present. Otherwise, it
works perfect. I will applly your suggestion on error handling.

Thanks for all your help.
 

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

Similar Threads


Top