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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping the focus at the end of the last record 1

Status
Not open for further replies.

bxgti4x4

Technical User
Feb 22, 2002
167
GB
I have a sub form which displays four records based on a selection in the main form. Each record contains four fields, three of which are for information and the fourth is where data is entered.

Thanks to Lupins46 I have the focus moving down through the four records, stopping only on the field in which data is entered. However, when I update the last field, the focus moves to the next data entry field in a blank record.

Is there any way I can enter the data in the last record and stop the focus moving to the next record?

Best Regards
John

 
If you are never entering in a new record, and only updating those with already populate information fields, then I would set the AllowAdditions property to False for the subform.
You can code a procedure for the KeyDown_Event in the data-entry control in the subform, and then set the focus where you want:

If KeyCode = vbKeyTab Or KeyCode = vbKeyReturn then
Me.Parent.txtControlName.SetFocus
End if

so when a user presses tab or enter in this control the focus is set to txtControlName on the main form.
 
Make the set the tab stop for the non dataentry fields to no, and set the enabled to no.
 
SarahG,

Thanks for that, its so simple when you know how!

Best Regards
John
 
hneal98

Thanks for the suggestion, that was the bit that Lupins46 sorted out for me.

Best Regards
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top