Help with setting focus

G

Guest

I have a main form with an unbound sub form. The main form has an option
group with several toggle buttons. The source object of the unbound sub form
is filled at run time when the user clicks on the toggle buttons for the form
they want.
The problem:
Let us say that I have 5 toggle buttons in the option groups and the user
selected # 1. I want, when the user goes to the last field on the sub form,
to automatically select toggle # 2 and open sub form that is attached to
toggle # 2 and so on.
When I tried to do so I kept getting a message saying that access can not
set the focus to the option group.

Any Idea how can I accomplish this.
Thanks
Al
 
G

Guest

try and assign a value to the toggle buttons group, if the button toggle # 2
value is 2 then assign a value 2 to the toggle button group name
 
G

Guest

I am not quite sure I understand. Here is the line of code I used
Parent.optQuestSelect = 2
when the user in the subform attached to "optQuestSelect", toggle #1 then
the user goes to the last field on the sub form. after the field loses the
form the "optQuestSelect" .toggle #2 is pressed however, the sub form does
not change to the right sub form attached to toggle # 2. It is still showing
the original?
what I need is after the next toggle button changes on the option group, the
sub form changes accordingly.
thanks
Al
 
S

Steve Schapel

Al,

Try it like this...

With Me.Parent
.optQuestSelect = 2
Call .optQuestSelect_AfterUpdate
End With

First of all change the After Update procedure of the option group from
Private to Public.
 
G

Guest

Its also depend where you put the code, if you put the code in the after
update of the option group then call that sub what ever button you wat to be
pressed.
if you put the code under each button then you should call the sub of the
after upate/on click (depend where you put it) of each button depending what
you want to select.
Just in case the right place to put it will be on the after update of the
option group with
select case me.optiongroup
case 1
case 2
çase 3
case 4
end select
That way you have to call one sub
 
G

Guest

Steve, Ofer
thank you very much for your response. I do have the code behind the
optQuestSelect_AfterUpdate event. I agree with you that this should work,
however, I am getting the following error message:

Run-Time Error '2465':
"Application-defined or Object-defined error"
any idea?
thanks
Al
 
S

Steve Schapel

Al,

Did you use the method I suggested? Did you change the sub from Private
to Public?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top