Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab from main form to a sub form on a tab control 1

Status
Not open for further replies.

HisSheep

Programmer
Sep 25, 2009
7
US
How do I program VBA to jump from a text field on the main form to a combo field located on a sub form attached to a tab control in Access 2007?
 
Generally the code sets the focus to the subform first. The next line of code would set the focus to the combo box. Having the subform on a tab control makes no difference (at least in previous versions).

Duane
Hook'D on Access
MS Access MVP
 
Thanks for the tip. Now I need to make tab control change to a specific page when the user clicks the save (record) command button. Any ideas?
 
I don't think there's a direct way to activate a specific tab. Can you assign an accelerator to the tab page you want and then do a SendKeys "%x" in the button click event (where x is the accelerator key you assigned to the tab)?
 
Set its value (0 for activating page1, 1 for page2 etc.).

combo
 
Sheesh, I sure botched that one. I thought for sure I tested setting the Value property. Nothing like advising someone on the most convoluted solution possible :~/

Thanks for setting things straight combo.
 
Here is what I have been trying so far.....I hope one of you guys will catch what I am doing wrong. In the last text box before needing to hop to the tab control page that holds my subform I tried putting

Lost Focus()

TabCtl49.Pages(0).SetFocus 'Tabl Control page
frmDependents.SetFocus 'Set Focus on subform


into the "On Lost Focus" event

I am really new to this VB stuff...........when I test
if the Tab control page (0) is on top everything flows fine.
If the user leaves Tab control page (1) on top the tab order goes completely out of wack!
 
Thank you dhookom. I tried your suggestion of putting

frmApplications!TabCtl49.Pages(0).SetFocus

into the "Save Record" command button. I put it in
at the beginning because an "On error" dialog telling
the user that the record is saved...was already in there
along with the focus to move the cursor to a search text box.

It worked! Now every time the user clicks "Save" the
Tab (0) gets the focus, a dialog says record is saved, and the focus moves to the look up text box. Thanks everyone..I love this forum!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top