Change image according to field value

G

Gaetan

I have an image on a tab of a tab control that I'd like to change depending
of a field value. I know VB code can help me do this but I am not proficient
with VB code in Access yet.

The images are that of an icon representing a Male and the other a Female.
The default image represents a male but needs to show a female icon when
cboGender displays Female. The image needs to show the proper image when that
specific tab is accessed and when the cboGender combo box that determines the
field value is changed.

Anyone can help me out with this?
 
P

Pieter Wijnen

the simplest way I know off is
Make one image control for male & female (place them in the page
header/footer - you shouldn't print forms anyway, or visible=False with
height 0) + the one you have (gender)

then if you use a optiongroup (Checkbox or combobox is very similar)

Private Sub OptSexChange_AfterUpdate()

Dim C As Access.Control

If Me.OptGroup.Value = 1 Then
Set C = Me.Male
Else
Set C = Me.Female
End If

Me.Gender.PictureData = C.PictureData
End Sub

Also

Private Sub Form_Current()
OptSexChange_AfterUpdate
End Sub

HTH

Pieter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top