Subform to Subform navigation (repost)

  • Thread starter Thread starter AlCamp
  • Start date Start date
A

AlCamp

I posted this question earlier today, but since I've solved some issues, and
subsequently, I've been able to better define the problem...

I have a main form (frmMain) with 3 individual and seperate subforms (not
nested).
I'd like to create a method whereby the user can, by keystroke (ex. Alt-S)
send the cursor to the next subform.
(If the user is in frmSub1 the Alt-S would take them to frmSub2... if in
frmSub2 then the user would go to frmSub3.)

I created a button on frmSub1 (cmdGoToSub2) with a Caption = &S, so that
when the user enters Alt-S the code should fire.
In the On Click event of cmdGoToSub2...
Me.Parent.frmSub2.SetFocus

OK.. if I physically mouse click the button, the code works just fine. The
cursor goes to the first field in frmSub2, and I see it there. Wicked good!

However, if I use Alt-S to fire the code, the cursor only goes to the
calling button on frmSub1.
If I then hit the F9 key, the cursor goes... correctly... to frmSub2. (I
put Refresh in the code, but it does not work)

How can I get Alt-S to run the code the same way as physically clicking the
GoTo button?

Thanks for any help in advance,
Al Camp
 
As a work around you could code the On Got focus event of your cmdGoToSub2
command button to either run the same code as you originally wanted want or
execute a send keys statement such as

SendKeys "{F9}", False

If you had the tab stop as the last field on you subform, this would also
automatically navigate to the next subfom when the use pressed tab. maybe a
good thing, maybe not. Consider you tab stops.

Girffo.
 
Thanks Groffo,
I have the code in both the OnClick and the GotFocus events, with the
same results...
Clicking the button works fine... Alt-S doesn't.

Also, I have the cmdGoToSub2 button in the header of the subform, as I
want the user to be able to hit Alt-S at any time.

I'll keep the SendKeys in mind, but as a matter of course, I try to never
use SendKeys. It raises cain with my users who use the Num Keypad.

Thanks for your help though... it's appreciated.

Al Camp
 
In responding to Griffo's response, something occured to me... perhaps the
problem was the location of my GoTo button.

I moved the cmdGoToSub2 button from the Header of the subform to the Detail
section, and now the Alt-S works fine...just like the manual clicking.

OK, now... the only question I have (Fingers-crossed)... can I have Alt-S
fire my code WITHOUT an actual button or control. I don't want to see the
button, and I don't want to "tab" to it when I enter Alt-S.

Thanks all,
Al Camp
 
Back
Top