Enter Instead of Tab
By Richard Rost
15 months ago
Use Enter Key to Move to Next Record in Access
In this Microsoft Access tutorial, I will show you how to use the Enter key instead of the Tab key to move to the next record in a form. We will cover how to create command buttons and set up default properties to trigger form navigation without any programming.
Ludwig from Dessel, Belgium (a Platinum) asks: Hi, how can I navigate through the records in a form using the Enter key instead of the Tab key? Is there a video on this, possibly with VBA code as an event procedure or something similar? My boss is acting strange again about how it goes faster with the Enter key instead of the Tab key.
Members
There is no extended cut, but here is the database download:
Silver Members and up get access to view Extended Cut videos, when available. Gold Members can download the files from class plus get access to the Code Vault. If you're not a member, Join Today!
Prerequisites
Recommended Courses
Up Next
Keywords
TechHelp Access, Use Enter key to move in Access, Enter instead of Tab in Access, Microsoft Access navigation, Access form navigation, Enter key event Access, VBA Enter key, continuous form navigation, navigate records Access, Access UI customization, record navigation buttons, keystroke navigation Access, shift enter Access.
Transcript
Welcome to another TechHelp video brought to you by AccessLearningZone.com. I'm your instructor, Richard Rost. Today, we're going to talk about how to use the Enter key instead of the Tab key to move to the next record in Microsoft Access.
Today, I'm going to show you how to do it for beginners, and then in tomorrow's video, actually Monday's video since today is Friday, we're going to show you a developer method that's got some additional flexibility. Today's question comes from Ludwig in Dessel, Belgium, one of my Platinum members. Ludwig says, "How can I navigate through the records in a form using the Enter key instead of the Tab key? Is there a video on this possibly with some VBA code or an event procedure or something similar? My boss is acting strange again about how it goes faster with the Enter key instead of the Tab key."
Yeah, I get it. If you hit Enter, it just behaves like the Tab key does normally. Just hit Tab or Enter does the same thing. It'd be nice if the Enter key moved you down, kind of like in Excel. And you could, if you wanted, also program it to work the same way with a single form, so you hit Enter and it moves to the next record. But let's see how we can do this.
First, a couple of prerequisites. First, of course, if you're a newbie to Access and you haven't watched my Access Beginner 1 class, go watch it. It's four hours long. It's absolutely free. It covers a lot of fundamentals that you really should know. For example, you should know what command buttons are and how to use the command button wizard to create them. In fact, this video specifically teaches you how to make command buttons to navigate back and forth through the records on a form, which is kind of what we're doing today.
This video shows you how to set a default button. A default button is the button that gets clicked when you press the Enter key on your keyboard. Now, you put these two videos together and you've got the answer for today's video.
Let's start with the continuous form. So I'm going to come into here, Design View, and I'm going to go up to Form Design, grab a command button, and drop it right here so the wizard starts up. I'm going to pick Record Navigation, go to Next Record, hit Next, put some text on there. You can put Next Record on there. It's fine. You can even put "Enter" to visually tell the user, hey, if you press the Enter key, it's going to go to the next record. It's going to push this button.
Next, give it a good name. Next Record Button or something like that, and then hit Finish. So now you've got a button that will go to the next record. Save it, close it, open it back up again. And now if I click the button, you can see it moves to the next record. Even if I'm over here, hit the button, it still moves to the next record. So you can still use Tab.
Now, how do I assign this button as the button that's pressed when I push the Enter key? Well, that's what that default property is for. Back here in Design Mode, open up the properties for this button by double-clicking on it. Come over to the other tab here and look for Default. We're going to change the default to Yes. Default means when I press Enter on the keyboard anywhere on this form, unless you're in a long text field, then it pushes that button.
So let's save it, close it, open it, and now Enter, Enter, Enter, Enter, Enter. See? Tab, Tab, Tab, Tab. Enter, Enter, Enter, Enter. Nice. Easy enough. Tell the boss it's not so weird now. This will work on a single form or a continuous form. So we can copy that button. You can actually take this button and copy it. Then go over to a different form, like the regular customer form. Right-click Design View, and we can paste it right on here.
Make this a little bit bigger, and then Paste, and then bring it down here. Now, even though the button macro carries with it, because inside this button, there's something called Embedded Macro, and that will copy over with it. But you still got to open up the properties and assign this guy to be the default button on this form. Save that, close it, close it, close it. Let's open up the customer form, and now we can use Tab to move through the fields, but Enter will still move us now to the next record. See, that's pushing that button, that next record button.
Now, as far as going to the previous record, if your boss wants to go backwards, there's a couple of things you could do at the beginner level. You could make another button to move to the previous record. I mean, if he's too lazy to use these buttons down here, I guess. Then you could assign that to a keystroke, like Alt P for previous, or you could even make it the Cancel button, and he can hit Escape to go backwards, but that's kind of weird too. I like the previous button myself, so let's do another command button. Drop it down here.
Record Navigation, go to Previous Record. Previous, I'll just put P-R-E-V in there, make it small, like that. Next, and the previous record button. What we're going to do to make this assigned to a keystroke, we're going to come right in here, and we're going to put an ampersand in front of that P. Here I'll zoom in so you can see it better. See that little ampersand right in front of the P? Press Enter, and now when you do that, you get a little underscore under the P. Now this just becomes a training issue now. Just tell the boss, well, if you want to go back a record, it's Alt P. That's just the easiest way to do it.
Save it, close it, open it, and now you can go Enter, Enter, Enter, Enter, or Alt P, Alt P, Alt P, Alt P. It's up to you. You can make an Escape button too. To make an Escape button, you just go to the Properties, and under Other, you set this Cancel button to True. Then when the user presses Escape, it pushes that button. I wouldn't recommend that for just moving backwards through records, though.
Now, in Part 2, when we get to the VBA version, I'm going to teach you how to do this with events, and you can actually assign the previous button something like Shift Enter. So it would be Enter to go forward, and then Shift Enter, or Control Enter, or whatever you want, to go back a record. We'll talk about that in Part 2.
Now, there is one caveat, and I kind of mentioned it a minute ago when you're in here. If you happen to be inside of a long text field, the Enter key gives you a new line in the field, see, just like that. So your default button won't get pressed unless you tab out of there and then press Enter. Oh, even that time, I happened to be on a button because this was next in the tab order. If you're sitting on another button, like the Orders button, then you press Enter. That will take precedence, too.
What you can do in this particular case is you could say, okay, for my long text fields, instead of the Enter key behavior being new line in a field, you can change this to default. What that will do is it will make it so that if you're in here and you press Enter, it's going to fire that button's event because it'll no longer move to a new line. If you do want to go to a new line now, you have to hit Control Enter to go to a new line. Or you can open up the Zoom box, Shift F2, and now you can type in here, and this is just like a regular little word processor.
There's a lot of things you can do. There's ifs and thens and that's and buts and everything has an exception. All kinds of things you can do. But if your weird boss's primary concern is just being able to move to the next record with Enter, well, there you go. There's an easy, nice beginner fix for you with absolutely no programming.
If you do want to see how to do it with some programming, I'm going to be talking about that in Part 2. Let's see. This video goes public on Friday, August 9, 2024. On Monday, the 12th, we will talk about the VBA version, which is a little more work but a little more powerful. But I do like to give the beginners some videos too from time to time.
So that is going to be your tech help video for today. I hope you learned something. Live long and prosper, my friends. I'll see you Monday for Part 2.
TOPICS: How to use the Enter key to navigate records Creating command buttons for navigation Setting a default button in Access Customizing default button properties Making command buttons to navigate records Copying buttons to different forms Assigning buttons to keystrokes Creating a "Previous Record" button Utilizing the ampersand to create shortcuts Setting the Cancel button property Handling long text fields with the Enter key Changing Enter key behavior in text fields Using the Zoom box for text fields
COMMERCIAL: In today's video, I will show you how to use the Enter key instead of the Tab key to move to the next record in Microsoft Access. We'll start by creating a command button with the wizard, naming it 'Next Record Button', and assigning it as the default button to be activated with the Enter key. You'll get to see practical steps on setting this up in both continuous and single forms. Plus, I'll throw in how to navigate to previous records using a shortcut key. Check out the complete video on my YouTube channel and website at the link shown. Live long and prosper, my friends.
Quiz
Q1. What is the main objective of the tutorial? A. To teach how to use the Enter key instead of the Tab key to move to the next record in Microsoft Access B. To teach how to navigate through the records using voice commands C. To learn how to design new forms in Microsoft Access D. To teach advanced VBA programming techniques
Q2. What button property is changed to use the Enter key for moving to the next record? A. Enabled B. Default C. Cancel D. Visible
Q3. In the tutorial, which view in Microsoft Access is used to design the command button? A. Datasheet View B. Layout View C. Form View D. Design View
Q4. What should be done to ensure the command button is activated when the Enter key is pressed? A. Assign a click event to the button B. Make the button the Cancel button C. Set the button's Default property to Yes D. Set the button's tab order to the first position
Q5. What is the purpose of the ampersand (&) in the button's text property? A. To italicize the text B. To create a shortcut key C. To make the text bold D. To underline the text
Q6. What default behavior is mentioned for the Enter key when inside a long text field? A. It saves the record B. It clears the text field C. It gives a new line in the field D. It deletes the current record
Q7. What alternative method is suggested for moving to a new line within a long text field if the Enter key behavior is changed? A. Alt + Enter B. Shift + Enter C. Ctrl + Enter D. Ctrl + Alt + Enter
Q8. What alternative key combination is recommended for moving to the previous record? A. Ctrl + P B. Shift + Tab C. Alt + P D. Ctrl + Space
Q9. What should be set to True to allow the Escape key to push a button? A. Enabled Property B. Visible Property C. Default Property D. Cancel Property
Q10. What future tutorial content is promised in Part 2 of the video series? A. Advanced Excel integration with Access B. Using VBA to assign custom behaviors to keys C. Creating reports in Microsoft Access D. Developing web applications with Access
Answers: 1-A; 2-B; 3-D; 4-C; 5-B; 6-C; 7-C; 8-C; 9-D; 10-B
DISCLAIMER: Quiz questions are AI generated. If you find any that are wrong, don't make sense, or aren't related to the video topic at hand, then please post a comment and let me know. Thanks.
|