Keeping the focus in the same field??

mike wild

Registered User.
Local time
Today, 16:52
Joined
Feb 16, 2003
Messages
69
How do you get the focus to remain in the same place (same field) after a new record has been found.
At the monent it just gose back to ID field (perhaps because it is tab stop 1)
 
Your question is a bit short on details, but code in the On Current event of the form may be appropriate or you can change the tab order. If you can give a few more details on what you are trying to do I am sure that someone here will have the answer you seek.

Jack
 
I have a form with 49 small text boxes taht i populate with numbers in a 7 X 7 grid format (similar to excel)
At the moment i am on record "1" and the focus is in field "text10".

When i do a find record search and i move to a different record, say to record 30. The focus moves does not stay in field "text10" but moves back to the "id" field.

I would like the focus to stay in field "text10" until i move it.
Can this be done?
 
Depending on how you 'find' record 30, you can use code to set the focus to the control you want. For example, Me.Field10.SetFocus will set the focus to Field10 but you will have to determine when and where to use this code as I do not know how you are 'finding' record 30, etc.

hth,
Jack
 
we use the docmd.findrecord "bla bla" command.

What we need to do is before the command is somehow record the position (current field) of the focus, then after the findrecord command re-set the focus back to the same field.

I hope you understand what i mean.
 
Yes i have tried it - but unsucsessfully.

Here is what i have.
On form one a command button with the following procedure:

Dim DocName As String
DocName = "find"
DoCmd.OpenForm DocName

Which opens for number two called "Find".
Form number two has a command button called "ID search".
Here is the code for the ID Search button.

Dim kevin As String
kevin = [Forms]![find]![id search]
Forms![find].Visible = False
DoCmd.GoToControl "id"
DoCmd.FindRecord kevin, A_START
Screen.PreviousControl.SetFocus
DoCmd.Close A_FORM, "find"
DoCmd.CancelEvent

And the focus always goes back to the first field on the FIND form which is called "ID".
I would like to to remain where it was perviously before the find we opened the first form.
 

Users who are viewing this thread

Back
Top Bottom