Solved How to search a form by clicking an image? (1 Viewer)

Sun_Force

Active member
Local time
Today, 18:43
Joined
Aug 29, 2020
Messages
396
I'm trying to type something in a textbox in the header of a form and filter the form.
After typing the keyword in the textbox, if I click a button, the focus moves to the button, the textbox is updated and the procedure in on_Click of the button filters the form.

If I try to click an image to start filtering (instead of a command button), the focus doesn't move to the image, hence the textbox is not updated, Access thinks the textbox is still empty and can not filter the form with the keyboard.
I have to click another control to update the textbox and then click the image to start filtering.


Is there any way to bypass this second click? I mean is there anyway to simply type something in a textbox and click an image to run a procedure?

Thanks for any kind of advice.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:43
Joined
Oct 29, 2018
Messages
21,357
You could assign the image to your button and resize the button, so you can use it. I think you can also format the button as flat, so it doesn't look like a button.
 

Sun_Force

Active member
Local time
Today, 18:43
Joined
Aug 29, 2020
Messages
396
@theDBguy thanks for looking in.

No, unfortunately I can not use a button instead of an image.

1- the image is png and transparent. A button can not be. (it can, but there's a lot difference between the result)
2- there are several mayor properties that buttons lack, comparing to images. Size mode is one of them. You can zoom/stretch the image.
You can also change picture alignment for images (top left, top right, center, etc)
these properties help to change the size of an image without affecting what is shown.

If I use a button with an image on it, the size of the button should be the same as the size of the image. and apparently the result is not what I'm looking for.

thanks again.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 04:43
Joined
Feb 28, 2001
Messages
26,996
When I check an image control's properties, it has both an OnClick event and a control.SetFocus method. I suppose you could try to include the control.SetFocus in the OnClick event routine.
 

Sun_Force

Active member
Local time
Today, 18:43
Joined
Aug 29, 2020
Messages
396
@The_Doc_Man
Thanks for helping.
Althogh image control has SetFocus property, But Access gives me this:

2021-09-08_13-28-42.jpg


Help button, opens this page:
 

Gasman

Enthusiastic Amateur
Local time
Today, 09:43
Joined
Sep 21, 2011
Messages
14,038
So, you could try.....
Setting focus to another control, not your pic ?
Use the Text property of your textbox ?
 

Users who are viewing this thread

Top Bottom