Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Ctrl-A Select Long Text < KeyDown | Global Status Fn >
Ctrl-A Select Long Text
By Richard Rost   Richard Rost on LinkedIn Email Richard Rost   10 months ago

Use Ctrl-A to Select All Text in MS Access Text Box


 S  M  L  XL  FS  |  Slo  Reg  Fast  2x  |  Bookmark Join Now

In this Microsoft Access tutorial, I will show you how to use Ctrl+A to select all text in a long text box, rather than all records. We'll explore programming techniques using VBA, such as utilizing the key down event, sel start, and sel length, to customize Access to your needs.

Evelyn from Lombard, Illinois (a Platinum Member) asks: My database has long text fields that I use for entering and editing notes from my field techs. In most applications, pressing Ctrl+A selects all the text in the current field or document, but in Access, it selects all the records instead. This is frustrating because I often want to quickly select all the text in a field while typing or editing so I can cut/copy and paste it. How can I change this behavior so Ctrl+A works the way it does in other applications?

Members

There is no extended cut, but here is the file 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

Links

Recommended Courses

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsCtrl-A Select Long Text in Microsoft Access

TechHelp Access, Ctrl-A behavior Microsoft Access, VBA select all text, KeyDown event Access VBA, SelLength SelStart VBA, custom shortcuts Access VBA, SetFocus method Access, Access text field programming, trapping key events Access, handling long text fields Access, copying text clipboard Access

 

 

 

Comments for Ctrl-A Select Long Text
 
Age Subject From
9 monthsAnother Great TipBrent Davis
10 monthsSecurity Flaw for Password ManagerJason Fleishman
10 monthsCan we make this a Global FunctionJohn Schreiber

 

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to Ctrl-A Select Long Text
Get notifications when this page is updated
 
Transcript In today's video, we're going to learn how to use Control A to select all the text in a long text box based on a long text field in Microsoft Access. Today's question comes from Evelyn in Lumbard, Illinois, one of my platinum members. Evelyn says, "My database has long text fields that I use for entering and editing notes from my field text. In most applications, pressing Control A selects all the text in the current field or document, but in Access, it selects all the records instead. This is frustrating because I often want to quickly select all the text in a field while typing or editing so I can cut, copy, or paste it. How can I change this behavior so Control A works the way it does in other applications?"

That can be annoying. I've run into this myself in the past. Let me show everybody else what we're talking about. In most other applications like Microsoft Word, here's a Word document. If I hit Control A, it selects all the text. I can then copy, paste, whatever with it. In Excel, if I hit Control A, it selects everything. I can cut, copy, and paste. Even in Notepad, if I hit Control A, it selects all the text. I can cut, copy, and paste it.

If you want to read a cool story, we're warfin' Jetsia Huntsam Troubles. I'll pause now and read that. But in Microsoft Access, if you're in a form and you hit Control A, even if you're in this long text field, if you hit Control A, it actually selects all the records, all the text on all the records. If I hit Copy now, Control C, and I go back into Notepad, let's open up Notepad here, you open up a different window, and it pastes all the records. No, I don't want that.

So, what do I want to do here? Well, Evelyn is working with long text fields where she is working with reports and text. She wants to be able to, as she's typing, hit Control A and select all the text in that long text box, so she can then do stuff with it.

Before we get started, this is going to be a developer-level video. What does that mean? That means if you've never done any VBA programming before, go watch this video. It's about 20 minutes long. It'll teach you everything you need to know to get started. We are going to use the key down event to trap when the user hits Control A, so make sure you watch this video to understand how the key down event works. Make sure you understand how set focus works, and make sure you understand sel start and sel length.

To watch these videos, if you're not familiar with any of this stuff, they're all free, they're on my YouTube channel, they're on my website, go watch them and come on back. First thing I'm going to do real quick is I want to make this text box bigger just for the purposes of class. Let's make this a little bit larger like that so we've got some room to see our long text field.

There are some ways you could do this without programming. For example, if you're in here and you want to select all the text, you could shift-tab and then tab back into it, and then hit copy, Control C. That's one way to do it. You could hit Control Home and then Control Shift, and that'll select all the text. That's kind of hard though. You've got to remember all those keys.

You could even associate a label with this and then use the Alt trick. You could assign Alt A to it and then hitting Alt A will select all the text too. For example, let's say over here in "first name", right, with a label here, let's say I want to put an ampersand in front of N. Now, see how there's an underline under N? Alt N will now select that field. So you can come back in here and if I'm over here now and I go Alt N, it selects that field.

Those are all things you could do without programming, but Evelyn wants to be able to hit Control A and select all that text. So we need a little bit of programming to do that. First, let's do the easy thing. Let's make a button that'll do that first. I like to show things with buttons first. Drop a little button down here. Cancel the wizard. We'll call it Select Text Button.

A lot of times when I'm playing around with something first, even if it's not going to be in a button, I'll put it in a button just to get it to work. Then I'll move it where I want it because buttons are easy. I can avoid programming events and all kinds of crazy stuff. I'll just throw it in a button, put it on a menu, and that way you can make sure it's working. Let's go into the button code.

Now, I want to select all the text in that field. So first you go to the field: Notes.SetFocus. Then: Notes.SelStart = 0. That says put the cursor before the first character. If you didn't watch the sel start video, go watch that. Then we're going to select all the text by saying: Notes.SelLength = Len(Notes), whatever's in there.

You could also come up here and say: If IsNull(Notes) Then Exit Sub. Maybe put that after you move there. That way it'll put the cursor there either way, but if there's nothing in there, it won't bother doing any of that stuff. Save it, debug compile once in a while.

Now we'll come in here and I'll hit "Select Text". There you go. So now we've got a button that does it. You could even do the same thing with the button that I showed you before. You can put the ampersand in front of "S" in "Select Text". Now you can do Alt S, and that will select all that text. But Evelyn doesn't want Alt S; she wants Control A.

How do we do that? We're going to have to use the key down event to capture Control A. Go to Design View, into the events, and into the key down event. If you haven't watched the key down video, go watch it now. The key code for "A" is 65. The shift code for Control is 2. So: If KeyCode = 65 And Shift = 2 Then ' This is Control A has been pressed.

What are we going to do? Well, pretty much the same stuff from the button. Copy that over. Actually, we probably want our IsNull in here too, because if there is no code in here, we'll do that, exit out. When we're all done, we're going to set the KeyCode = 0. We're going to blank the keycode.

If any of this is unfamiliar, go watch the key down video. I literally covered this exact same thing—well, kind of. Save it, debug compile. Now, come in here. I'm typing, I'm typing, I'm typing, Control A—and there you go. It selects all that text for you instead of selecting everything.

You can even make Control A copy that text to the clipboard, saving you another keystroke if you want to. Just come in here, and then right there, say: DoCmd.RunCommand acCmdCopy. Right, that copies the selected item to the clipboard. Throw a Beep in there too. Save it, type it, I'm typing, I'm typing, Control A, and it's now in the clipboard. Test it. Go back to Notepad, read my story, and then paste. There's all that text that I just copied.

This is a practical application for all that key down stuff that we learn and sel start and sel length. And that's getting Access to do exactly what you want to do. The whole point of Access is to make your job easier. If you want it to behave a certain way, then do it: take those Legos and put them together and make the form listen to you. That's the whole point of building your own application in Access: the database does what you want it to do. You don't have to change the way you work to fit your software.

If you like stuff like this, I've got tons more developer classes on my website; come and check them out. I'm working on Developer 47 right now, so there are hundreds of hours of videos for you to learn. Stop by and join in the fun. But that's going to do it for your TechHelp video for today. I hope you learned something. Live long and prosper, my friends. I'll see you next time.



TOPICS:
Using Control A to select text in Access
Difference in Control A behavior across apps
Working with long text fields in Access
Key Down event handling in Access
Setting focus to a text field with VBA
Using SelStart and SelLength in VBA
Creating a button to automate text selection
Using IsNull condition in VBA
KeyDown event to capture Control A
Copying text to clipboard using DoCmd.RunCommand
Adding keyboard shortcuts with ampersand in labels

COMMERCIAL:
In today's video, we're going to learn how to make Control A select all text in a long text box in Microsoft Access, just like it does in other apps. Frustrated by Access selecting all records instead? We've got you covered! Learn to capture the Control A command using VBA key down events, involving key code handling with sel start, and sel length. We'll also show you how to make Control A copy text to the clipboard too. This developer-level tutorial is packed with practical tips, so get ready to make Access work for you. You'll find the complete video on my YouTube channel and on my website at the link shown. Live long and prosper my friends.
Quiz Q1. What is the default behavior of Control A in Microsoft Access when a user is in a form with long text fields?
A. It selects all the text in the current field.
B. It selects all records in the database.
C. It copies the text to the clipboard.
D. It pastes the clipboard content into the field.

Q2. Which event is used to customize the behavior of Control A to select all text in a field in Access?
A. On Load event
B. Key Down event
C. Click event
D. After Update event

Q3. What VBA property is used to place the cursor at the beginning of the text in a field in Access?
A. SelLength
B. SetFocus
C. SelStart
D. GetFocus

Q4. How can you select all text in a long text box without any programming in Access?
A. Using Control End and Control Shift
B. Using Control Alt and Control N
C. Using Alt Tab and then Shift Tab
D. Using Shift Tab and then Tab & Control C

Q5. How can you programmatically copy selected text to the clipboard in Access using VBA?
A. Clipboard.AddText
B. DoCmd.RunCommand acCmdCopy
C. TextBox.Copy Method
D. Control Copy Method

Q6. What is the key code for the letter "A" that is used in the Key Down event to detect when Control A is pressed?
A. 66
B. 65
C. 64
D. 62

Q7. What programming condition is used to exit the subroutine if the long text field is empty?
A. If IsNull(Notes) Then Exit Sub
B. If Notes = Null Then Exit Sub
C. If Empty(Notes) Then Exit Sub
D. If IsEmpty(Notes) Then Exit Sub

Q8. When using the Key Down event to customize Control A, why is it important to set KeyCode = 0 at the end?
A. To prevent the default behavior of Control A
B. To save the variable KeyCode for future use
C. To clear any recorded keyboard history
D. To increment the KeyCode value for other keys

Q9. What additional functionality was suggested to automate after selecting all text using Control A in Access?
A. Automatically saving the record
B. Automatically copying the text to the clipboard
C. Automatically printing the text
D. Automatically closing the application

Q10. Why does the video emphasize making Access do exactly what you want it to do?
A. To ensure compatibility with other Microsoft Office applications
B. To reduce manual data entry errors
C. To customize the software to fit your workflow
D. To comply with database administration standards

Answers: 1-B; 2-B; 3-C; 4-D; 5-B; 6-B; 7-A; 8-A; 9-B; 10-C.

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.
Summary Today's TechHelp tutorial from Access Learning Zone focuses on a common issue encountered by many Access users: using Control A to select all text within a long text box field. Evelyn, one of our platinum members from Lumbard, Illinois, brought this up. She finds it frustrating that Control A, which typically selects all text in applications like Word or Excel, ends up selecting all records in Access. Her aim is to have Control A function similarly within long text fields for easier text management, such as cutting, copying, or pasting content.

This is a situation I've faced myself. Let me explain how Access behaves differently compared to other applications. In Word or Excel, pressing Control A selects all content, allowing you to manipulate it as needed. Even in simple tools like Notepad, this shortcut selects all text readily. However, in Access, pressing Control A while in a form's long text field selects all records instead, which is clearly not the desired outcome when you just want to edit text.

Evelyn wants Control A to function like it does in other software while working with reports and text fields in Access. To achieve this, we'll need to delve into some developer-level solutions. If you haven't worked with VBA programming before, I recommend watching an introductory 20-minute video on my website. It will help you understand the key components of the solution we'll be using, including the key down event, set focus, sel start, and sel length.

For those not yet familiar with these concepts, all necessary resources are available for free on my website and YouTube channel. After gaining a foundational understanding, you can implement the solution presented here.

As a preliminary step, you can experiment with non-programming tricks to select all text, like using shift-tab followed by tabbing back into the field, or employing Control Home and Control Shift. Another approach involves associating a label with the text box and using the Alt key to select it. For instance, placing an ampersand before a character in a label makes it selectable with the Alt key. However, these methods can be cumbersome and are not as straightforward as Evelyn's goal for Control A.

Let's explore a bit of programming to achieve this functionality. Initially, I suggest creating a button that executes the desired action. Label it appropriately and use it to perfect the process before integrating it more seamlessly. The button code essentially involves setting the text box focus, positioning the cursor, and selecting all text using sel start and sel length properties.

To implement Control A specifically, you'll need to handle the key down event. This involves a bit of coding to check if Control A is pressed and then triggering the same selection process. If needed, you can even automate copying the selected text to the clipboard within this event, saving additional steps. Adding an auditory Beep confirms the action.

Ultimately, mastering these techniques allows you to customize Access behavior, aligning it with your workflow. Access is all about tailoring your database to meet your requirements without altering how you operate. If heightening your Access proficiency intrigues you, my website hosts a variety of developer classes. Stay tuned for more learning opportunities in Developer 47 and beyond.

That concludes our TechHelp tutorial for the day. For a complete video tutorial with detailed instructions on everything discussed, visit my website at the link below. Live long and prosper, my friends.
Topic List Using Control A to select text in Access
Difference in Control A behavior across apps
Working with long text fields in Access
Key Down event handling in Access
Setting focus to a text field with VBA
Using SelStart and SelLength in VBA
Creating a button to automate text selection
Using IsNull condition in VBA
KeyDown event to capture Control A
Copying text to clipboard using DoCmd.RunCommand
Adding keyboard shortcuts with ampersand in labels
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 11/13/2025 10:10:14 AM. PLT: 4s
Keywords: TechHelp Access, Ctrl-A behavior Microsoft Access, VBA select all text, KeyDown event Access VBA, SelLength SelStart VBA, custom shortcuts Access VBA, SetFocus method Access, Access text field programming, trapping key events Access, handling long text fi  PermaLink  Ctrl-A Select Long Text in Microsoft Access