admin管理员组文章数量:1129021
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
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
- According to the desired results layout image4 should be true. – Shahram Alemzadeh Commented Jan 9 at 14:51
1 Answer
Reset to default 0It 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
本文标签: vbaHiding Images In MS Access ReportStack Overflow
版权声明:本文标题:vba - Hiding Images In MS Access Report - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736717057a1949256.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论