Tab Page and Set FOcus

D

DonElston

I have a 9 page tabbed form. I am using Access 2007 and have tried it as
2007 and even saved it as 2003 Access. When data is placed in the last field
of a page a new record is opened. Not what I want.

I have tried multiple codes and always get errors. I have tried command
buttons and get nothing.

I want to go from the last field in tabpage0 to the first field in tabpage1.

When I put in the page number the return is always cannot find.

Any help would be greatly appreciated.
 
A

Allen Browne

Add a tiny unbound text box as the last one in the tab order on your
tabpage0.

In its Got Focus event, save the record, and SetFocus to the desired control
on tabpage1.

Example:

Private Sub Text78_GotFocus()
If Me.Dirty Then Me.Dirty = False
Me.Text99.SetFocus
End Sub
 
D

DonElston

Private Sub Text195_GotFocus()
If Me.Dirty Then Me.Dirty = False
Me.Text197.SetFocus

End Sub

I still get errors "INVALID OUTSIDE PROCEDURE"

????
 
A

Allen Browne

There is something else in your module that is not right, or you don't have
these lines in the correct place.

In the code window, choose Compile in the Debug menu.
Fix any errors.
Repeat until it compiles okay (i.e. the Compile item grays out without any
errors.)
 
D

DonElston

Allen,

Thanks for the help. I had an "END SUB" at the very top of the page. When
I ran debug/compile, it found it and once it was deleted, all works well.
Thanks so much.

Don Elston
 
Top