Button to navigate through subforms

  • Thread starter Thread starter Access Joe
  • Start date Start date
A

Access Joe

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!
 
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 :)
*
 
Back
Top