Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report question

Status
Not open for further replies.

freefour

MIS
Aug 26, 2004
33
US
Hi,

I have a simple report that contains a picture (I have the visible properity set to No). I want to use an If statement in the On Open event to cause the picture to become visible if two fields on the report are equal for my printout.

This is what I am looking for

If Me.Total.Value = Me.AmountPaid.Value then
ImgPaid.Visible = True
End if

However, I can not get a .Value option for the total field or the AmountPaid field. I also can not get a .Visible option for any of them either.

What am I doing wrong? I am sure that I've done this in the past.

Thanks for your help!

--freefour
 
freefour
Have you tried this...

Code:
On the OnFormat event for the report, put
If Me.Total = Me.AmountPaid Then
Me.ImgPaid.Visible = True
Else
Me.ImgPaid.Visible = False
End If

Tom
 
Thanks Tom, but there is on OnFormat event in my Report. I have:

On Open
On Close
On Activate
On Deactivate
On No Data
On Page
On Error

I am using Access 97.

Any other ideas?

Thanks,
--freefour
 
freefour
My fault. My post was a little misleading.

There isn't a Format event for the report itself. Right Click on the Detail section. There is an On Format event for the Detail section. Put the code in there.

Tom
 
I have a similar problem... Being that I am using a hyperlink for a picture on a report. I can get the picture to show in an image control but if there is no file name in me!photo, the report uses the previous picture. This is the code I am trying to use on the OnFormat event of the report:

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

    If (IsNull(Me!Photo)) Then
    Me![Image].Properties("Picture") = ""

    Else
    
        Dim strFilePath As String
        strFilePath = DFirst("Location", "tblLocation") & Me!Photo
        
        If Dir$(strFilePath) <> "" Then
        'It exists
        Me![Image].Properties("Picture") = DFirst("Location", "tblLocation") & Me!Photo

        Else
        'It don't.
        Me![Image].Properties("Picture") = ""

        End If
        
        
    End If

End Sub

Image = Image control
Photo = file name
DFirst("Location", "tblLocation") = File path location


Can anyone tell me what I am doing wrong?

Thanks, BakerUSMC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top