Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Button to navigate through subforms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Access Joe - 02 May 2008 14:18 GMT
In an environment that contains mutliple forms and subforms, when you reach
the end of the last subform, you have to manually click out to get to the
next main record.  Can you create an automated way of navigating through
subforms so people don't have to know about CTRL/TAB when they want to go
from form to form, and so when they reach the end, all they have to do is hit
tab to move to the next main record?

Thanks so much!
strive4peace - 03 May 2008 20:42 GMT
Hi Joe,

use the key press event and trap for a TAB

to go to another subform:

'~~~~~~~~~~~~~~~~~
Private Sub Controlname_KeyPress(KeyAscii As Integer)
 If KeyAscii = 9 Then
  Me.Parent.SubformControlname.SetFocus
  Me.Parent.SubformControlname.form.Controlname.SetFocus
 End If
End Sub
'~~~~~~~~~~~~~~~~~

to go to the parent form and then to the next record (this is not
tested!), try this:

'~~~~~~~~~~~~~~~~~
Private Sub Controlname_KeyPress(KeyAscii As Integer)
 If KeyAscii = 9 Then
  Me.Parent.SubformControlname.SetFocus
  Me.Parent.recordset.movenext
 End If
End Sub
'~~~~~~~~~~~~~~~~~

this will have an error if you are already on the last record -- it can
be handled, but I did not want to overload you with code right now --
basics first <smile>

Warm Regards,
Crystal

Access Basics
8-part free tutorial that covers essentials in Access
http://www.accessmvp.com/Strive4Peace/Index.htm

 *
   (: have an awesome day :)
 *

> In an environment that contains mutliple forms and subforms, when you reach
> the end of the last subform, you have to manually click out to get to the
[quoted text clipped - 4 lines]
>
> Thanks so much!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.