Tabbing and setting focus on a button

afreymor

Registered User.
Local time
Today, 16:42
Joined
Sep 11, 2013
Messages
10
Hi all,

I have a form with a tab control on it. The input for respective fields are placed inside the tab control, and I have the "Confirm" button placed outside, on the main form. Now I wanted to be able to navigate my focus from a control from inside to tab control, out to the Confirm button on the form, to allow smooth flowing data entry.

However, it seems like Access separates the tab indexes for the controls in the tab control and outside on the main form, so setting tab index does not work. I tried using the code ON LOST FOCUS and SET FOCUS;

Private Sub txtPurchaseNote_LostFocus()
Forms![frm Imported]![cmdConfirmPurchase].SetFocus
End Sub

But then a dialog box appears:

Run-time error '2110'
Microsoft access can't move focus to the control cmdConfirmPurchase

(cmdConfirmPurchase is a button control)

Is there anyway around this, or is there something wrong with my coding? Any help would be much appreciated, thanks in advance!
 
you could have a button on the subform that does the same thing as the main form. set your tab controls to forcus that and voila.
 
Hi shutzy,

Thank you for replying (and sorry for replying late). Yes, I have considered that as an option but if possible I would like to leave that as a last resort. There are a few other main-form-level buttons on my form which I feel should stay out of each individual control tab since they perform the same functions.
 

Users who are viewing this thread

Back
Top Bottom