UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Change focus from one form to another    
 
   
cyberal
post Nov 11 2010, 04:37 PM
Post #1

UtterAccess Addict
Posts: 121



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
Go to the top of the page
 
+
theDBguy
post Nov 11 2010, 04:43 PM
Post #2

Access Wiki and Forums Moderator
Posts: 48,645
From: SoCal, USA



Hi,

What is the code you're using to open form2 from form1? By any chance are you using the acDialog argument?
Go to the top of the page
 
+
cyberal
post Nov 11 2010, 04:51 PM
Post #3

UtterAccess Addict
Posts: 121



I am using .... DoCmd.OpenForm "form4", acNormal
Go to the top of the page
 
+
theDBguy
post Nov 11 2010, 04:53 PM
Post #4

Access Wiki and Forums Moderator
Posts: 48,645
From: SoCal, USA



Hi,

I 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...
Go to the top of the page
 
+
cyberal
post Nov 11 2010, 05:36 PM
Post #5

UtterAccess Addict
Posts: 121



theDBguy,
As usual, you come through again! I just needed to shake the leaves out of the trees a little.
Thanks again
Go to the top of the page
 
+
theDBguy
post Nov 11 2010, 05:41 PM
Post #6

Access Wiki and Forums Moderator
Posts: 48,645
From: SoCal, USA



Hi cyberal,

(IMG:style_emoticons/default/yw.gif)

Glad to hear it worked out for you. Good luck with your project.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th June 2013 - 01:57 AM