Full Version: Change focus from one form to another
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
cyberal
I have form1 opening form2. On form 2, I enter some data. When I'm done on form2, I want form2 to stay open but set the focus back to form1. When I'm done using form2, I will then close form2. On form2, I have a button that simply tries to set the focus back to form1 using forms!form1!setfocus and I have tried setting focus to a control on form1 using forms!form1!mybutton!setfocus but neither is working so I know I am doing something wrong. Can anybody help me with the syntax?
Thanks in advance
Cyberal
theDBguy
Hi,
That is the code you're using to open form2 from form1? By any chance are you using the acDialog argument?
cyberal
I am using .... DoCmd.OpenForm "form4", acNormal
theDBguy
Hi,
see. So, if this is your actual syntax:
Forms!form1!SetFocus
then try replacing the bang with a dot:
Forms!form1.SetFocus
Hope that helps...
cyberal
theDBguy,
As usual, you come through again! I just needed to shake the leaves out of the trees a little.
Thanks again
theDBguy
Hi cyberal,
Glad to hear it worked out for you. Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.