0

I have an access database where I have checkboxes for 5 items

These checkboxes all relate to a different image

I would like these images to appear in a report, hiding those which are not ticked and also hiding the location to make the appearance look better.

for example

image1 = true
image2 = true
image3 = false
image4 = false
image5 = true

I have been able to hide the images, but I would prefer for them to be hidden completely

I would like to see Image1 | Image2 | Image4 | Image5

Rather than Image1 | Image2 | | | Image4 | Image5

1
  • According to the desired results layout image4 should be true. Commented Jan 9 at 14:51

1 Answer 1

0

It sounds like you want to keep a running total of where to position the image, and then adjust that at the same time that you show/hide the images. A crude version could be as follows:

Const imgStart AS Double = <SomeValue>
Const imgSpacing AS Double = <OtherValue>
Dim imgLeft AS Double

imgLeft = imgStart

With picImage1
    If image1 Then
        .Visible = True
        .Left = imgLeft
        imgLeft = imgLeft + .Width + imgSpacing
    Else
        .Visible = False
    End If
End With

With picImage2
    If image2 Then
        .Visible = True
        .Left = imgLeft
        imgLeft = imgLeft + .Width + imgSpacing
    Else
        .Visible = False
    End If
End With

With picImage3
    If image3 Then
        .Visible = True
        .Left = imgLeft
        imgLeft = imgLeft + .Width + imgSpacing
    Else
        .Visible = False
    End If
End With

With picImage4
    If image4 Then
        .Visible = True
        .Left = imgLeft
        imgLeft = imgLeft + .Width + imgSpacing
    Else
        .Visible = False
    End If
End With

With picImage5
    If image5 Then
        .Visible = True
        .Left = imgLeft
        imgLeft = imgLeft + .Width + imgSpacing
    Else
        .Visible = False
    End If
End With

This uses imgLeft to track what the left position of the next image should be, and increments it by the Image Width, plus a spacer, each time it makes an image visible.

You could refine it using a loop to track things, and also by adding a vertical component: i.e. if imgLeft + .Width is greater than your desired page-width, then you increase an imgHeight variable and reset imgLeft = imgStart to begin another row of images

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.