INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Adjusting Report spacing when some pictures are involved

Adjusting Report spacing when some pictures are involved

(OP)
I have a DB that contains questions for students. Some of the questions have pictures as part of the question. I have built a report showing what I need but I have spacing issue.

The Picture object dose NOT have a "can grow", or "can shrink" property so I can't shink it down so the questions without pictures occupy a smaller area than the questions with pictures. The report may contain many questions and I need some way to automatically shrink the space between them if there is no picture. We do not want to have just one question per page.

Can some one help?

RE: Adjusting Report spacing when some pictures are involved

Can the picture show by itself above or below the question? Is each question a record or is your table un-normalized?

Duane
Hook'D on Access
MS Access MVP

RE: Adjusting Report spacing when some pictures are involved

(OP)
Duane- I answered this an hour ago but not I find it did not post.

So..Yes each question is a record.

Currently I have it set so the picture shows below the question...has to be there.

Thanks,

RE: Adjusting Report spacing when some pictures are involved

I would create a duplicate detail section by making a group footer based on the primary key of the table. You can then cancel the rendering of this section in the On Format event if there is no picture.

Duane
Hook'D on Access
MS Access MVP

RE: Adjusting Report spacing when some pictures are involved

(OP)
OK...I set Question_ID to autonumber. I created a grouping on question_ID. I placed the "Image" frame in the question_Id group footer.
I select the Question_ID footer and the On Format event.

Code for the event:

CODE -->

Private Sub GroupFooter2_Format(Cancel As Integer, FormatCount As Integer)
    If Me.Image Is "" Then
    MsgBox "No Picture"
    DoCmd.CancelEvent
End Sub 

I used the CancelEvent because it was the only cancel showing.
This does not work. So, when you say cancel the rendering...how would I do that?

Thanks,

RE: Adjusting Report spacing when some pictures are involved

Is Image a bound control in your report section?
Do you get a msgbox pop up?
If Image is a field, what is its data type?
Where is your "End If"?

If Image is a text box bound to the path of a picture and it might be empty, I would try:

CODE --> vba

Private Sub GroupFooter2_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = IsNull(Me.Image)
End Sub 

Duane
Hook'D on Access
MS Access MVP

RE: Adjusting Report spacing when some pictures are involved

(OP)
Duh End if. Silly me.

Image is a picture frame that has its Control Source set to Graphic. Graphic is a text field in the table with the link to the picture stored in another folder.
No message popup.

Ok, I entered your suggested code for the QuestionID Footer On Format Event. Just like you wrote it above.
I did not work. The first question does not have a picture...but the large space where the picture would show is still showing. The second quest that does have a
picture shows as it should. So, we still have not removed the large space present in the QuestionID Footer.

Can you detect what I may be doing wrong.

RE: Adjusting Report spacing when some pictures are involved

Add a text box [txtGraphic] to the section and set its control source to [Graphic].

CODE --> vba

Private Sub GroupFooter2_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = IsNull(Me.txtGraphic)
End Sub 

or

CODE --> vba

Private Sub GroupFooter2_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = Len(Me.txtGraphic & "") = 0
End Sub 

Duane
Hook'D on Access
MS Access MVP

RE: Adjusting Report spacing when some pictures are involved

(OP)
We are not there yet.
I entered both of your codes...one at a time of course. I also placed the "Graphic" control in the QuestionID Footer area. I changed your code to just Graphic not txtGraphic.

I ran it with both codes. The large space (QuestionID Footer) still shows for the Question without a picture/graphic.

I also put a temporary control in the QuestinID Footer to show the length of the Graphic control. The Question without a graphic is blank. The question with the graphic shows 83 characters.

Am only using your one line code and nothing else...no If or anything.

Thanks,

RE: Adjusting Report spacing when some pictures are involved

It works exactly as expected for me in a test database. Are you viewing the "Print Preview" or "Report View"? Code doesn't run in the Report View.

This is my code:

CODE --> vba

Private Sub GroupFooter1_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = IsNull(Me.graphic)
End Sub 

Duane
Hook'D on Access
MS Access MVP

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close