on doubleclick, change focus

eibyer_apc

New member
Local time
Yesterday, 22:50
Joined
Mar 1, 2022
Messages
18
I have a form with a text box that displays query numbers. I have it set to open the query on double click and that works. I just want to change the focus after the double click event so that the text box is not selected, maybe shift focus on the main form?

This is after the double click event.
1649096302747.png
 
Have you tried setting the focus to a different control? You can either use DoCmd.GoToControl or Me.ControlName.SetFocus to do that.
 
That did it! Thank you. Just had to make sure to do the setfocus before my docmd.openquery.
 
That did it! Thank you. Just had to make sure to do the setfocus before my docmd.openquery.
Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 
Opening queries that users can interact with is as dangerous as it gets. It is really poor practice. Users should only see forms or reports. That way you have events that can be used to control what updating is acceptable and perform proper validation. When you let users open naked queries, they can do whatever they want if the query is updateable.

A form in DataSheet view is almost as flexible as a query if you want to allow the user filtering and sorting options.
 
Noted. I'm the only user for now so I'm not worried about that part yet. If I get comfortable enough to create a project that involve other users then I would definitely try to avoid displaying the query and instead present a datasheet view form that actually makes more sense now that you pointed it out :)
 
I can be just as sloppy as the next guy (gal) so even when building for myself, I try to do it "right".
 

Users who are viewing this thread

Back
Top Bottom