Set Focus to Subform on a Navigation form from a different form!

wjyoung

Registered User.
Local time
Today, 11:25
Joined
Jan 21, 2011
Messages
13
Hello forum,

In Access 2010 I have a Navigation type form ("navformname") with a few subforms (e.g. "subform1name").

I have a third separate form ("thirdformname") with a list box that contains possible values contained in "subform1name". I have a double-click event in a list box on "thirdformname" that feeds values to particular controls in "subform1name". After setting objects in "subform1name" according to the values being fed by the double-click event, I want to switch focus from "thirdformname" to "subform1name".

Note: The navigation form "navformname" is already open when the user double-clicks an item in "thirdformname".

I am able to feed the values just fine, but can not figure out how to set focus. On double-click:
Set mySubForm = Form_subform1name
With mySubForm
.subform1control.Value = myvalue
.Visible = True
.SetFocus
End With

I get an error on ".SetFocus":
"Run-time error '91': Object variable or With block variable not set"
I tried just setting focus on the navigation form, starting with a command to set a form variable like this:
Set myNavForm = Form_navformname
Here again I a different error:
"Run-time error '424': Object required"
If I skip any attempts to change focus, "thirdformname" retains focus. When I manually switch to "navformname" I find the correct value has indeed been set. It's just that I can't set focus.

Does anyone have any suggestions on this problem? Any helpful feedback would be appreciated.

Thanks,

WJ
 

Users who are viewing this thread

Back
Top Bottom