Solved How to search a form by clicking an image?

Sun_Force

Active member
Local time
Today, 22:10
Joined
Aug 29, 2020
Messages
392
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.
 
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.
 
@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.
 
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.
 
@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:
 
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

Back
Top Bottom