How to remove blank image spaces from access report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mb60
    New Member
    • Aug 2008
    • 37

    #1

    How to remove blank image spaces from access report

    sir
    I created a multiple choice questions data bank in ms access. some questions have images. in the report blanks gaps are appearing when the question is without image. please help me in this regard. For your kind persual here the database is attached

    thank you

    mbtilak
    Attached Files
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    Try having the image in a sup-report, and set teh supreport properties
    CanGrow=True
    CanShrink=True
    Then also set the same for the Detail section of the report.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Just subscribing, have downloaded the DB and will look at it later. BTW, there are 7 Reports, which one are you referring to?

      Comment

      • mb60
        New Member
        • Aug 2008
        • 37

        #4
        Thank you
        Report English Paper

        Comment

        • mb60
          New Member
          • Aug 2008
          • 37

          #5
          Thank you for hint.
          I am not successful in getting the result

          Comment

          • TheSmileyCoder
            Recognized Expert Moderator Top Contributor
            • Dec 2009
            • 2322

            #6
            I have taken a look at your database, but it keeps getting errors which is probably due to the nature of your table design.

            Why do you have 50+ fields in a single table? Your trying to use a database like an excel sheet, instead of a database.

            I suggest you read this article on Database Normalization and Table Structures. You will need to get a better understanding of how databases work.


            Assuming you always expect 4 possible answers to a question,
            I would suggest a structure something along the lines:
            tbl_Questions (the table)
            with the fields:
            KEY_Question, Autonumber, Primary Key
            tx_Question, Text Field, with the actual question.
            tx_AnswerA, Text Field
            tx_AnswerB, Text Field
            tx_AnswerC, Text Field
            tx_AnswerD, Text Field.
            tx_CorrectAnswe r, Text Field

            Assuming you might have a different amount of possible answers for each question, you need 2 tables, but you can read about that in the article mentioned.

            Comment

            • mb60
              New Member
              • Aug 2008
              • 37

              #7
              thank you sir
              I tried the table structure given by you.
              Regarding images the same problem is persisting
              Even the image is used as subreport the blank spaces are continuing in the report.

              Comment

              • TheSmileyCoder
                Recognized Expert Moderator Top Contributor
                • Dec 2009
                • 2322

                #8
                Try setting your SQL of the supReport's recordsource to:

                Code:
                SELECT [Question Bank].ID, [Question Bank].Image
                FROM [Question Bank]
                WHERE ((([Question Bank].Image) Is Not Null));
                The Is Not Null clause will ensure you only get results when there is something in the image field.

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #9
                  If you wish to include ALL Records on your Report whether or not they have an Image assigned, and if you wish to remove the 'Spaces' created by the blank Object Frame containing the Images, this can be done via code in the Format() Event of the Report, but it will be a little tricky. Essentially what you would do is:
                  1. For Records that do not have an Image:
                    1. Set the Height of the Image Control to 0.
                    2. Adjust the Top Property of all Controls below the Image Control, basically moving them UP proportionally.
                    3. Resize the Detail Section of the Report, basically shrinking it by the Height of the Image Control.
                  2. For Records that do have an Image:
                    1. Maintain their relative positioning by utilizing the their Tag Property to store their original Top Values.

                  P.S. - The explanation is simple, the implementation would be much more difficult.

                  Comment

                  • TheSmileyCoder
                    Recognized Expert Moderator Top Contributor
                    • Dec 2009
                    • 2322

                    #10
                    A sup-report has the beauty of only appearing when there is something to show. No need to programmaticall y change it all.

                    Comment

                    • ADezii
                      Recognized Expert Expert
                      • Apr 2006
                      • 8834

                      #11
                      Sorry TheSmileyOne, I was under the impression that the Sub-Report approach was not working.

                      Comment

                      • TheSmileyCoder
                        Recognized Expert Moderator Top Contributor
                        • Dec 2009
                        • 2322

                        #12
                        The Issue I had forgotton to take into account was that since the image is stored in the same table as the question, there is an ID for each "Image row", whether or not there is an image. Im used to working with subform/subtables, in which case there would only be an entry if you actually added a image. Thats why the "Is not Null" clause should be included.

                        Comment

                        • mb60
                          New Member
                          • Aug 2008
                          • 37

                          #13
                          Originally posted by ADezii
                          If you wish to include ALL Records on your Report whether or not they have an Image assigned, and if you wish to remove the 'Spaces' created by the blank Object Frame containing the Images, this can be done via code in the Format() Event of the Report, but it will be a little tricky. Essentially what you would do is:
                          1. For Records that do not have an Image:
                            1. Set the Height of the Image Control to 0.
                            2. Adjust the Top Property of all Controls below the Image Control, basically moving them UP proportionally.
                            3. Resize the Detail Section of the Report, basically shrinking it by the Height of the Image Control.
                          2. For Records that do have an Image:
                            1. Maintain their relative positioning by utilizing the their Tag Property to store their original Top Values.

                          P.S. - The explanation is simple, the implementation would be much more difficult.
                          sir
                          what is that code?

                          Comment

                          • mb60
                            New Member
                            • Aug 2008
                            • 37

                            #14
                            Originally posted by mb60
                            sir
                            I created a multiple choice questions data bank in ms access. some questions have images. in the report blanks gaps are appearing when the question is without image. please help me in this regard. For your kind persual here the database is attached

                            thank you

                            mbtilak
                            I request you to to make adjustments to meet the requirement in the attachment file. This will help the teaching community in making objective type of questions. Thank you

                            Comment

                            • ADezii
                              Recognized Expert Expert
                              • Apr 2006
                              • 8834

                              #15
                              Try TheSmileyOne's Sub-Form approach first, since creating the code that I previously described would be time consuming to say the least.

                              Comment

                              Working...