Make image interact with control source (1 Viewer)

KaylaHansa

New member
Local time
Yesterday, 19:30
Joined
Mar 22, 2020
Messages
18
In a continuous form, each record has as yes/no field. Is there a way to have one image displayed in that record if the field = yes, and another if the field=no? I figured out how to do this in a single view form, but cannot figure out how to make this apply at an individual record level in a continuous form.
 

June7

AWF VIP
Local time
Yesterday, 18:30
Joined
Mar 9, 2014
Messages
2,995
Are images stored externally? An IIf() expression in ControlSource can dynamically display images.
 

KaylaHansa

New member
Local time
Yesterday, 19:30
Joined
Mar 22, 2020
Messages
18
They are stored in the database. I attempted to do an Ilf() expresson in the ControlSource of the image and couldn't get it to work :unsure:
 

June7

AWF VIP
Local time
Yesterday, 18:30
Joined
Mar 9, 2014
Messages
2,995
No, expression will not work with internal stored images.

Programmatically setting properties affects ALL instances of control on form. Can be done on report.
 
Last edited:

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 22:30
Joined
May 21, 2018
Messages
3,164
It will work with internally stored images. Make a small table. First field is YesNo and second field is Image. This table has two records no and the no image, yes and the yes image. Link your table to this table by the yesNo field.

YesNoForm.jpg
I used an attachment field.
 

KaylaHansa

New member
Local time
Yesterday, 19:30
Joined
Mar 22, 2020
Messages
18
MajP this works really well, except for the little popup that displays allowing you to add/remove attachments in form view. Is there a way to disable it?
 

June7

AWF VIP
Local time
Yesterday, 18:30
Joined
Mar 9, 2014
Messages
2,995
Try locking the image control so it cannot be edited.
 

KaylaHansa

New member
Local time
Yesterday, 19:30
Joined
Mar 22, 2020
Messages
18
I've already tried that and it doesn't work unfortunately 😒 Disabling it does work but I have an OnClick event added to it, and when it is disabled the click event no longer works.
 

June7

AWF VIP
Local time
Yesterday, 18:30
Joined
Mar 9, 2014
Messages
2,995
Have another control on top of the image for the click event code. A transparent textbox or rectangle should work.
 

arnelgp

error reading drive A:
Local time
Today, 10:30
Joined
May 7, 2009
Messages
9,350
on the Attachment control Property Sheet->Data, set Enabled to No.
 

KaylaHansa

New member
Local time
Yesterday, 19:30
Joined
Mar 22, 2020
Messages
18
Thanks everyone for the help, I was able to make it work for me! :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom