Image White Space

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
I've got 10 small images in a report that appear depending upon whether a tick box (for each image) has been ticked. I'd like to have all of them in a row and in the event eg Image 8 is unticked, Image 9 and 10 (if both of them are ticked) move to the left to fill in the gap.

Usually there are only approx 4 images ticked for each record and can use VBA to adjust the 'left' value for each image but as you'd appreciate there are so many different permutations and my coding is inefficient at the best of times.... Any ideas?
 
Code:
[color=green]' 10 check boxes named Check1 to Check10
' 10 Images named Image1 to Image10[/color]
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim intTop   As Integer
    Dim intLeft  As Integer
    Dim intGap   As Integer
    Dim intIndex As Integer
    Dim strImage As String
    Dim strCheck As String
    
    intTop = 2500
    intLeft = 1000
    intGap = 50
    
    For intIndex = 1 To 10
        strImage = "Image" & CStr(intIndex)
        strCheck = "Check" & CStr(intIndex)
        
        If Me(strCheck) = True Then
            Me(strImage).Visible = True
            Me(strImage).Top = intTop
            Me(strImage).Left = intLeft
            intLeft = intLeft + Me(strImage).Width + intGap
        Else
            Me(strImage).Visible = False
        End If
    Next intIndex

End Sub
 
Absolutely perfect - thank you so much for your time
 

Users who are viewing this thread

Back
Top Bottom