how to avoid focus for specific control (1 Viewer)

eugzl

Member
Local time
Today, 09:37
Joined
Oct 26, 2021
Messages
125
Hi All.
I created continuous form with option for label header to sort it. And replace inside of label two buttons with arrow up and arrow down.
btnLabel.png

In case when I click label to sort form in ASC order upper triangle will hidden. When I click label to sort form in DESC order down triangle hidden and upper will appears. All work fine until mouse don't click one of triangle. In case when I click one of triangle I getting error message:
Run-time error '2165':
You can't hide a control that has the focus.

How to solve the problem to avoid set focus on buttons with arrow up and arrow down in case when click on them?
Thanks.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:37
Joined
Oct 29, 2018
Messages
21,447
Move the focus away from the control you want to hide before hiding it.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 14:37
Joined
Jul 9, 2003
Messages
16,269
Oops!

I deleted my post because I assumed you were filtering not sorting!
 

eugzl

Member
Local time
Today, 09:37
Joined
Oct 26, 2021
Messages
125
Move the focus away from the control you want to hide before hiding it.
Hi theDBguy. Thanks for reply.
Good idea. Strange why I didn't guess by myself. I created txtBox with height and width equal 0 and created Click event them in case click on buttons with triangles where I set focus on that txtBox.
Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 06:37
Joined
Oct 29, 2018
Messages
21,447
Hi theDBguy. Thanks for reply.
Good idea. Strange why I didn't guess by myself. I created txtBox with height and width equal 0 and created Click event them in case click on buttons with triangles where I set focus on that txtBox.
Thanks
Hi. Glad to hear you got it working. Good luck with your project.
 

Users who are viewing this thread

Top Bottom