Current record on clicking unbound image (1 Viewer)

bodylojohn

Registered User.
Local time
Today, 05:25
Joined
Dec 28, 2005
Messages
205
Hello everyone,

I have a continious form with a picture of a delete button.
When I press the button I want to see the currentrecord ID.

To test this I simply use the code msgbox(me.ID.value)

When I click on the unbound image the msgbox shows the first ID no matter wich row I click.

However....When I click in a textbox in the row (the row gets the focus) and then I press on the button, the right ID appears in the messagebox.

What can I do so the right ID appears?
 

boblarson

Smeghead
Local time
Today, 03:25
Joined
Jan 12, 2001
Messages
32,059
You will need this:

Code:
Screen.PreviousControl.SetFocus
MsgBox Me.ID
 

HiTechCoach

Well-known member
Local time
Today, 05:25
Joined
Mar 6, 2006
Messages
4,357
Hello everyone,

I have a continious form with a picture of a delete button.
When I press the button I want to see the currentrecord ID.

To test this I simply use the code msgbox(me.ID.value)

When I click on the unbound image the msgbox shows the first ID no matter wich row I click.

However....When I click in a textbox in the row (the row gets the focus) and then I press on the button, the right ID appears in the messagebox.

What can I do so the right ID appears?

In what section have you placed the image control?

It sounds like it is probably in the form header or footer section. If this is true then you must first select a record in some way.. Normally by clicking in a control or the record select if visible.

To avoid having to first select the record, you will need to move the image control nto the detail section.
 

bodylojohn

Registered User.
Local time
Today, 05:25
Joined
Dec 28, 2005
Messages
205
In what section have you placed the image control?

It sounds like it is probably in the form header or footer section. If this is true then you must first select a record in some way.. Normally by clicking in a control or the record select if visible.

To avoid having to first select the record, you will need to move the image control nto the detail section.

Hello,

The image control is already in het detail section.

I hope that you can give me some more pointers
 

boblarson

Smeghead
Local time
Today, 03:25
Joined
Jan 12, 2001
Messages
32,059
Hello,

The image control is already in het detail section.

I hope that you can give me some more pointers

Did you try my code? You make sure you are on the record you want and then click the image. It should give you what you need.
 

HiTechCoach

Well-known member
Local time
Today, 05:25
Joined
Mar 6, 2006
Messages
4,357
Hello,

The image control is already in het detail section.

I hope that you can give me some more pointers

Did you try Bob's code?

I normally use a transparent command button over the image control. I use the command button's On Click event.
 

bodylojohn

Registered User.
Local time
Today, 05:25
Joined
Dec 28, 2005
Messages
205
Did you try my code? You make sure you are on the record you want and then click the image. It should give you what you need.

Hello,

Thanks for the tip.
Unfortunately it didnt work. I placed a button instead of the image. It looks ugly but it workt.
I think it is because the image control cant get the focus.
 

HiTechCoach

Well-known member
Local time
Today, 05:25
Joined
Mar 6, 2006
Messages
4,357
Hello,

Thanks for the tip.
Unfortunately it didnt work. I placed a button instead of the image. It looks ugly but it workt.
I think it is because the image control cant get the focus.

Why does it look ugly if the command button is transparent and the same size as the image control?

Ahh... just thought of this ....did you make sure to bring the command button tot he front the and/or send the image control to the back?
 

bodylojohn

Registered User.
Local time
Today, 05:25
Joined
Dec 28, 2005
Messages
205
Why does it look ugly if the command button is transparent and the same size as the image control?

Ahh... just thought of this ....did you make sure to bring the command button tot he front the and/or send the image control to the back?

Bro...you are a geniuos!!!

This works PERFECT.

Thanks for all your help!
 

Users who are viewing this thread

Top Bottom