J.R. Sitman
asked on
In Microsoft Access how do you prevent the cursor from going to a new field after you hit enter?
when entering data in a field that is for searching after you hit enter the cursor jumps to a different field. I do I set it so it does not leave the search field?
I don't have an environment set up right now that I could use to test this, so please keep that in mind, but can you utilize the event when the cursor leaves the box to place the focus back on the control that fired the event? (This may break your tab functionality and you would lose your ability to select another control)
Go to menu Files, Settings, Client settings.
Move setting in the first option, Move cursor with Enter, from:
Next field
to:
Do not move
Click OK and relaunch.
Move setting in the first option, Move cursor with Enter, from:
Next field
to:
Do not move
Click OK and relaunch.
Does this information get included in the database file or only with the particular Access Client that is accessing the database?
ASKER
will that setting apply to all fields? If so I do not want that.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can do something like this:
Private Sub YourTextBox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
KeyCode = 0
' Save form/record.
If Me.Dirty = True Then
Me.Dirty = False
End If
' or call your search function. Use Text if textbox not updated, as Value is not updated.
MySearchFunction Me!YourTextBox.Text
End If
End Sub
ASKER
Sorry, Lansing, it does work.
ASKER
Thanks
You are welcome