Create event on image component

ilanray

Member
Local time
, 01:00
Joined
Jan 3, 2023
Messages
126
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?
 
Can you post a sample db?
 
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?
 
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?
 
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.
 
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
 
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: 63
  • ex.accdb
    ex.accdb
    408 KB · Views: 79
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:
Can I Help with something about that file? it is working for me with the problem I wrote
 
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
 
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.
 
Ah- I made the mistake of responding to the notification:(
 
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
 
Interesting, I tried to add the Microsoft DAO 3.6 Object Library reference and got the following error:

1701271411957.png
 
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
 
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

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

Back
Top Bottom