Results 1 to 14 of 14
  1. #1
    Join Date
    Aug 2005
    Posts
    20

    Question Unanswered: question on reports

    Hi everyone

    I want to try somthing with a report and wondered if it is possable

    the source table for the report has a true/false column
    and my report has an image that will be included with every record

    Is it possable to set the visibility on the picture based on the true/false value?

    so some records will have the pic and others wont?

    what would be involved?

    Cheers for your time

  2. #2
    Join Date
    Oct 2005
    Posts
    178
    This may give you an idea. It doesn't matter want programming language you use but the logic is defined below

    Create a boolean function as ..


    function ShowImage(PValue as boolean) as boolean
    if PValue = true then
    ShowImage = true
    else
    ShowImage = false
    end if
    end function


    Then call out the function as boolean value for your Image control property like..

    ImageControlProperty.Visible = ShowImage(TrueFalseFieldValue)


    The TrueFalseFieldValue is a boolean value of the field of your records as you mentioned.
    I presumed your images names are link to each record by a column.
    Last edited by fredservillon; 11-23-05 at 19:57.

  3. #3
    Join Date
    Aug 2005
    Posts
    20
    Hi

    Thanks for that, I didnt have any luck getting it to work

    The image is on the report not in the table

  4. #4
    Join Date
    Oct 2005
    Posts
    178
    Well on your report, the image object should have a property right? What Report generator are you using?
    For Crystal Report you can use the suppress condition.

  5. #5
    Join Date
    Aug 2005
    Posts
    20
    Im just using a standard access 2000 report

  6. #6
    Join Date
    Oct 2005
    Posts
    178
    Then build an expression for your boolean text box that is bound to your field Yes/No.
    if the textbox.value is True, set the image visible property to true or yes. otherwise set it to false or no.

    To do this right click on your image object in design mode and select build expression..

  7. #7
    Join Date
    Aug 2005
    Posts
    20
    I appriciate your help, sorry if im a little slow
    I tried that but the expression keeps disapearing every time

    My VBA skills arnt too flash

    I have my image on my report called block
    I have a textbox (true/false) who's source is my yes/no column form my table, called blocktext
    I have the boolean fctn in the report's code

    it doesnt seem to like me adding the expression?

  8. #8
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Hi R33NZ,

    How are you creating your report? Based on a Query? If so, you place the CheckBox on the Report, (Visible=No) as you don't really need to see the CheckBox itself on the report. Then, go to DesignView of the report and click on the CheckBox, and go to Properties. In the AfterUpdate event you do this:

    CheckBox named cbxShowImage
    Image named imgNewImage

    Code:
    Private Sub cbxShowImage_AfterUpdate()
    
        If cbxShowImage = True Then   'meaing the CheckBox is marked
            imgNewImage.Visible = True
        ElseIf cbxShowImage = False Then
            imgNewImage.Visible = False
              
        End If
    End Sub
    That is straight out of one of my databases, just changed the object names for your situation. Hope this helps. BTW, some use 0 and -1 to show True and False.

    have a nice one,
    BUD

  9. #9
    Join Date
    Aug 2005
    Posts
    20
    Hi Bud,

    The report is based on a table,
    when I go in to the properties of the checkbox there isnt an AfterUpdate event

    If I try in on the report activate event it only looks at the first record and turns them all off or on

    Im running access 2000

  10. #10
    Join Date
    Oct 2005
    Posts
    178
    Quote Originally Posted by R33NZ
    Hi Bud,

    The report is based on a table,
    when I go in to the properties of the checkbox there isnt an AfterUpdate event

    If I try in on the report activate event it only looks at the first record and turns them all off or on

    Im running access 2000
    I'm back, Had to retire last night. Anyway, YOur statement above is proven right, It toggles the photo on or off for the report as dtermine by the last record read.
    There's a work around it and I explained below.
    I created a similar report using car photos that I already have in my computer. In my database table I added another text field called PHOTOA which would contain the names of the photo of the cars. For example record 1 will have "1A" in field PHOTOA and I have a corresponding image in the library called "1A.JPG". I Also have a jpeg image which I called "NOPHOTO.jpg" which I correspondingly enter "NOPHOTO" in field "PHOTOA" for records that have no photos. In my detail section below is only event I created..

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Image10.Picture = "C:\NetObjects Fusion MX\User Sites\Autos\Preview\" & TextPhoto.Text & ".JPG"
    End Sub


    See attached image files to view my report run and the design view.
    All text objects in the form are bound objects.

    P.S. By the way the red camaro car is mine..

    If you want to move into a web-based application which is more versatile see the sample here in my testing website site. From this website, if you click on the INVENTORY option and go down to see Stock no. 4, there's no photo showing. And if you see the other car details by clicking the photo, some have 4 photos some have fewer.


    This is the same idea above as I applied to what I'm showing you.
    http://www.servillon.com/autos/index.html
    Attached Thumbnails Attached Thumbnails AutoRpt.bmp   autorp2.bmp  
    Last edited by fredservillon; 11-24-05 at 23:18.

  11. #11
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by R33NZ
    Hi Bud,

    The report is based on a table,
    when I go in to the properties of the checkbox there isnt an AfterUpdate event

    If I try in on the report activate event it only looks at the first record and turns them all off or on

    Im running access 2000
    Sorry, my mistake,
    That was actually done in my form. In another report just now I did this:

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
        If Me.cbxWarnings = True Then
        Me.txtTardyReason.Visible = False
        Else: Me.txtTardyReason.Visible = True
        
      End If
    
    End Sub
    This was done in the Detail section of the report. It wasn't tested on an Image field but did make that field not appear just the same when the CheckBox was checked. Give it a whirl and see what happens.

    BUD

  12. #12
    Join Date
    Aug 2005
    Posts
    20
    Awesome!

    that works perfectly, thanks so much for everyones help with this

  13. #13
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    same as Bud - just saves a key stroke or two:

    Code:
     imgNewImage.Visible = cbxShowImage
    Testimonial:
    pootle flump
    ur codings are working excelent.

  14. #14
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    Quote Originally Posted by pootle flump
    same as Bud - just saves a key stroke or two:

    Code:
     imgNewImage.Visible = cbxShowImage

    Hey, way cool pootle. See, now that's what I'm talking about, we all helping each other. Now I have learned how to do it with a bit less typing. Great. And this is what we were telling Accessman2 the other day about trying to help yourself first. The code I had there was just some trial and error from things I had read and seen before, and was just tickled pink that it actually worked. Now I know a better way.

    thanks
    BUD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •