Create event on image component (1 Viewer)

ilanray

Member
Local time
Today, 12:35
Joined
Jan 3, 2023
Messages
116
Hi
I have a form with few bounded fields.
I created a click event on one of the textbox field, when I click on it I see the description something like
Code:
 MsgBox "you ID is " & me.idSubTask
that works fine
when I add an image component and create the same code it doesn't work.
what I want is to add an image which will act like the code i wrote
Is anyone can help me with that?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:35
Joined
Oct 29, 2018
Messages
21,473
Can you post a sample db?
 

Mike Krailo

Well-known member
Local time
Today, 05:35
Joined
Mar 28, 2020
Messages
1,044
when I add an image component and create the same code it doesn't work.
what I want is to add an image which will act like the code i wrote
Is anyone can help me with that?
I assume you are adding an image apart from the text box, is that correct? Normally, you add an image to an image control. The image control can contain the very same code you posted and it works just fine. What do you mean exactly by add and image? Add to what?
 

ilanray

Member
Local time
Today, 12:35
Joined
Jan 3, 2023
Messages
116
No, I added an image control not a text box control
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:35
Joined
Feb 19, 2013
Messages
16,612
when I add an image component and create the same code it doesn't work.
'doesn't work' means what exactly? nothing happens, you get an error? something else

what is the click property for your image control?
 

sonic8

AWF VIP
Local time
Today, 11:35
Joined
Oct 27, 2015
Messages
998
when I add an image component and create the same code it doesn't work.
what I want is to add an image which will act like the code i wrote
You should explain in more detail what you are trying to achieve and what/how it does not work.
An Image control also has a Click event that works exactly like the Click event of a Textbox. Your code should work there all the same.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 05:35
Joined
Feb 19, 2002
Messages
43,275
I have a form with few bounded fields.
The simple past tense of the verb to bind is bound. Bounded is the past tense of the verb to bound and should evoke images of a graceful Ibex caught in mid leap as he bounded across an open field.

English is a difficult language, even for native speakers, due to the number of irregular verbs.
Here is a useful site that gives you a full conjugation of any verb.
1701203944666.png
 

ilanray

Member
Local time
Today, 12:35
Joined
Jan 3, 2023
Messages
116
Hi
Attach an example. just put the file in "temp" folder for the image
load the form, you will see that if you click on the description you will get the correct ID. if you click on the image you will not get the correct id
 

Attachments

  • 1.png
    1.png
    2.3 KB · Views: 33
  • ex.accdb
    408 KB · Views: 41

KitaYama

Well-known member
Local time
Today, 18:35
Joined
Jan 6, 2022
Messages
1,541
your form is corrupted and I am unable to use it (unable to connect to active X server) -
The form is not corrupted. What you see is the name of Details, header, footer and labels of the form.
If you select them from combo box and change their name to English, the error will disappear. It's a problem with Access with non-English versions.
 
Last edited:

ilanray

Member
Local time
Today, 12:35
Joined
Jan 3, 2023
Messages
116
Can I Help with something about that file? it is working for me with the problem I wrote
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:35
Joined
Feb 19, 2013
Messages
16,612
if @KitaYama says it is not corrupted then OK with me. My solution was to create a new form for which worked for me.

I did change the names to english, but still got the same error
1701264187766.png


There is an ID field in the recordsource and in my newly created form, the code worked as intended, no need for a hidden control

1701264471384.png
 

KitaYama

Well-known member
Local time
Today, 18:35
Joined
Jan 6, 2022
Messages
1,541
There is an ID field in the recordsource and in my newly created form, the code worked as intended, no need for a hidden control
I noticed that.
That was why I edited and deleted that section as soon as I posted.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 10:35
Joined
Feb 19, 2013
Messages
16,612
Ah- I made the mistake of responding to the notification:(
 

ilanray

Member
Local time
Today, 12:35
Joined
Jan 3, 2023
Messages
116
I know it works on the textbox. can you please an image control and try to copy the vb from the textbox to the image control ?
You will see that the image control doesn't show the correct id
 

Mike Krailo

Well-known member
Local time
Today, 05:35
Joined
Mar 28, 2020
Messages
1,044
Interesting, I tried to add the Microsoft DAO 3.6 Object Library reference and got the following error:

1701271411957.png
 

ilanray

Member
Local time
Today, 12:35
Joined
Jan 3, 2023
Messages
116
This is a simple table. Juat create one called tasks add id, description, imageLocation fields and fill with some values
Then create a simple form bound the fields and create click event on the image that will show the id something like Msgbox "me=" & me.id
 

Mike Krailo

Well-known member
Local time
Today, 05:35
Joined
Mar 28, 2020
Messages
1,044
This is a simple table. Juat create one called tasks add id, description, imageLocation fields and fill with some values
Then create a simple form bound the fields and create click event on the image that will show the id something like Msgbox "me=" & me.id
If we create a new database and not from your sample database, everything works fine. It is your sample that doesn't work.
 

Attachments

  • NewSample.zip
    1.2 MB · Views: 46

theDBguy

I’m here to help
Staff member
Local time
Today, 02:35
Joined
Oct 29, 2018
Messages
21,473
This is a simple table. Juat create one called tasks add id, description, imageLocation fields and fill with some values
Then create a simple form bound the fields and create click event on the image that will show the id something like Msgbox "me=" & me.id
I haven't downloaded your file, but I also tried it on one of mine, and it worked fine.
1701273855576.png
 

Users who are viewing this thread

Top Bottom