Set Visible property of Image in Detail section of Report

mdwyer

New member
Local time
Today, 15:02
Joined
Mar 16, 2009
Messages
1
This was working, and I recently upgraded to 2007 and now I can't figure out how to fix it. Arrrr! :confused:

I have a set of stacked images on my report (Detail section) with property Visible set to No. For this example lets call them "imgState_green", "imgState_red", "imgState_blue".

I have a bounded field (text box) on my report (Detail section) which could have values of "1", "2", or "3" (numeric). Lets call it "idChangeTypes".

When I open my report, for each (Detail section) record with the field "idChangeTypes" = "1" I want the Visible property for "imgState_green" set to Yes so that that image would be visible. When "2" then "imgState_red", and when "3" image "imgState_blue" would be visible. Get the idea?

In my previous working version I had this code tied to the reports "Open" event, for 2007, now I'm no longer certain which event I should use.
[FONT=&quot]I am certain this will turn out to be something very simple, but until then I could use some help. So I have created a simple db with one table and one report to try and get this to work. (I have it available for anyone interested in looking/helping: http://www.mdwyer.net/access/TEST_FormsImageVisible.accdb

I have the following [Event Procedure] associated with the "On Format" of the "Detail" section of my report.

Code:
[/FONT]    [FONT=&quot]Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.imgState_green.Visible = (idChangeTypes.Value = 1)
    Me.imgState_red.Visible = (idChangeTypes.Value = 2)
    Me.imgState_blue.Visible = (idChangeTypes.Value = 3)
End Sub[/FONT]
  [FONT=&quot]
[/FONT]
 
I have a similar problem. Have you solved this problem in your report?
 
Set the Report's Default View to Print Preview, otherwise the format event does not appear to fire.
 
I have a similar problem. Have you solved this problem in your report?


Hi

I have a report which I would like to turn a certain fields on or off depending on whether the record source for the field control is null.

I would like to print label and the field control but if it is null, then I do not want the label or the field control to appear.

Hermes794
 
This was working, and I recently upgraded to 2007 and now I can't figure out how to fix it. Arrrr! :confused:

I have a set of stacked images on my report (Detail section) with property Visible set to No. For this example lets call them "imgState_green", "imgState_red", "imgState_blue".

I have a bounded field (text box) on my report (Detail section) which could have values of "1", "2", or "3" (numeric). Lets call it "idChangeTypes".

When I open my report, for each (Detail section) record with the field "idChangeTypes" = "1" I want the Visible property for "imgState_green" set to Yes so that that image would be visible. When "2" then "imgState_red", and when "3" image "imgState_blue" would be visible. Get the idea?

In my previous working version I had this code tied to the reports "Open" event, for 2007, now I'm no longer certain which event I should use.
[FONT=&quot]I am certain this will turn out to be something very simple, but until then I could use some help. So I have created a simple db with one table and one report to try and get this to work. (I have it available for anyone interested in looking/helping: http://www.mdwyer.net/access/TEST_FormsImageVisible.accdb

I have the following [Event Procedure] associated with the "On Format" of the "Detail" section of my report.

Code:
[/FONT]    [FONT=&quot]Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.imgState_green.Visible = (idChangeTypes.Value = 1)
    Me.imgState_red.Visible = (idChangeTypes.Value = 2)
    Me.imgState_blue.Visible = (idChangeTypes.Value = 3)
End Sub[/FONT]
  [FONT=&quot]
[/FONT]

Hi !

I have a report which I would like to turn a certain fields on or off depending on whether the record source for the field control is null.

I would like to print label and the field control but if it is null, then I do not want the label or the field control to appear.

Hermes794
 
Of the top of my head, try and use the following:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If isnull(me.Myfield) then
me.Myfield.Visible = False
' or use cancel = true to prevent record from being formatted
else
me.Myfield.Visible = True
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom