People have tried a variety of techniques to organize information. They’ve used Rolodexes, punch cards, cardboard boxes, vertical files, Post-it notes, 10,000-page indexes, and (when all else failed) large paper piles on flat surfaces. But after much suffering, people discovered that computers were far better at dealing with information, especially when that information is large, complex, or changes frequently.
That’s where Microsoft Access comes into the picture. Access is a tool for managing databases—carefully structured catalogs of information (or data). Databases can store just about any type of information, including numbers, pages of text, and pictures. Databases also range wildly in size—they can handle everything from your list of family phone numbers to a ginormous product catalog for Aunt Ethel’s Discount Boutique.
In this book, you’ll learn how to design complete databases, maintain them, search for valuable nuggets of information, and build attractive forms for quick and easy data entry. You’ll delve into the black art of Access programming, where you’ll pick up valuable tricks and techniques that you can use to automate common tasks, even if you’ve never touched a line of code before. And you’ll even explore the new web app feature that lets you put your database online so anyone can use it—provided you have a SharePoint server or an Office 365 hosting plan.
The modern world is filled with information. A web search for a ho-hum topic like “canned carrots” nets more than a million web pages. As a result, it’s no surprise that people from all walks of life need great tools to store and manage information.
It’s impossible to describe even a fraction of the different databases that Access fans create every day. But just to get you thinking like a database maven, here are some common types of information that you can store handily in an Access database:
Catalogs of books, CDs, rare wine vintages, risqué movies, or anything else you want to collect and keep track of.
Mailing lists that let you keep in touch with friends, family, and coworkers.
Business information, like customer lists, product catalogs, order records, and invoices.
Lists of guests and gifts for weddings and other celebrations.
Lists of expenses, investments, and other financial planning details.
Think of Access as a personal assistant that can help you organize, update, and find any type of information. This help isn’t just a convenience—it also lets you do things you could never accomplish on your own.
Imagine you’ve just finished compiling a database for your collection of 10,000 rare comic books. On a whim, you decide to take a look at all the books written in 1997. Or just those that feature Aquaman. Or those that contain the words “special edition” in the title. Performing these searches with a paper catalog would take days. On an average computer, Access can perform all three searches in under a second.
Access is also the king of small businesses because of its legendary powers of customization. Although you can use virtually any database product to create a list of customer orders, only Access makes it easy to build a full user interface for that database (as shown in Figure 1).
As you’ll see in this book, you’ll actually perform two separate tasks with Access:
Designing your database. This task involves creating tables to hold data, queries that can ferret out important pieces of information, forms that make it easy to enter information, and reports that produce attractive printouts.
Dealing with data. This task involves adding new information to the database, updating what’s there, or just searching for the details you need. To do this work, you use the tables, queries, forms, and reports that you’ve already built.
Most of this book is dedicated to task #1—creating and perfecting your database. This job is the heart of Access, and it’s the part that initially seems the most daunting. It’s also what separates the Access masters from the neophytes.
Once you’ve finished task #1, you’re ready to move on to task #2—actually using the database in your day-to-day life. Although task #1 is more challenging, you’ll (eventually) spend more time on task #2. For example, you might spend a couple of hours creating a database to keep track of your favorite recipes, but you’ll wind up entering new information and looking up recipes for years (say, every time you need to cook up dinner).
Although Excel’s perfectly good for small, simple amounts of information, it just can’t handle the same quantity and complexity of information as Access. Excel also falters if you need to maintain multiple lists with related information (for example, if you want to track a list of your business customers and a list of the orders they’ve made). Excel forces you to completely separate these lists, which makes it harder to analyze your data and introduces the possibility of inconsistent information. Access lets you set up strict links between tables, which prevents these problems.
Access also provides all sorts of features that don’t have any parallel in the spreadsheet world, such as the ability to create customized search routines, design fine-tuned forms for data entry, and print a variety of snazzy reports.
Of course, all this isn’t to say that Access is better than Excel. In fact, in many cases you might want Excel to partner up with Access. Excel shines when crunching reams of numbers to create graphs, generate statistics, or predict trends. Many organizations use Access to store and manage information, and then export a portion of that information to an Excel spreadsheet whenever they need to analyze it. You’ll learn how to take this step in Chapter 23.
Microsoft provides another database product—the industrial-strength SQL Server, which powers everything from Microsoft’s own search engine to the NASDAQ stock exchange. Clearly, SQL Server is big business, and many Access fans wonder how their favorite database software compares.
One of the most important differences between Access and database products like SQL Server is that Access is a client-side database. In non-techie terms, that means that Access runs right on your personal computer. Database engines like SQL Server are server-based: They store the data on a high-powered server computer, which you access from a garden variety PC. (This interaction happens over a local network or over the Internet, depending on how you’ve configured SQL Server.)
Server-based databases are much more complex to set up and maintain, but they provide enhanced performance and rock-solid stability, even when thousands of people use them at once. However, the only people that require high-end databases like SQL Server are large organizations. Amazon.com wouldn’t last 5 minutes if it had to rely on an Access database. But Access works just fine for most small and mid-sized businesses. It’s also perfect for personal use. (If you still have lingering doubts about whether Access can meet your needs, check out the box on When Access Isn’t Enough.)
Another important difference between Access and server-side database products is that Access is an all-in-one solution for storing and interacting with data. Server-side database engines like SQL Server focus exclusively on storing data (and sending that data to other computers when they request it). However, this single-minded design has a sizable price. An ordinary person can’t directly edit a database that’s stored by SQL Server. Instead, you need to use yet another program that can talk to SQL Server and ask for the information it needs. In most cases, this program needs to be hand-built by a savvy programmer. In other words, if you’re using SQL Server, you need to write a whole application before you can effectively use your database.
Sometimes, Access fans do turn into SQL Server gurus. You can start with a modest Access database and then step up to SQL Server when your needs exceed what Access provides. The process isn’t always seamless, but it’s possible. You can even keep using Access as a front end to manage your SQL Server database. You can learn about this trick in Chapter 21.
The ribbon is a super-toolbar that replaces the various toolbars that clogged the window in the ancient days before Access 2007. It’s clear, streamlined, and carefully organized into tabs—Home, Create, External Data, and so on. Initially, Access starts out with four tabs (although other tabs appear when you perform specific tasks).
When you create or open a new database, you start at the Home tab. Click the Create tab (as shown in Figure 2), and you get access to a slew of powerful commands that let you add new database components.
Here’s a quick rundown of the basic ribbon tabs:
File looks like a tab, but it’s actually the gateway into backstage view. The Quick Access Toolbar explains how backstage view works.
Home gathers together a variety of common commands including the familiar copy-and-paste tools and formatting commands for tweaking fonts and colors. You’ll also find handy features like sorting, searching, and filtering, all of which you’ll tackle in Chapter 3.
Create has commands for inserting all the different database objects you’ll learn about in this book (see Understanding Access Databases for the lowdown). These include the tables that store data, the queries that search it, the forms that help you edit it, and the reports that help you print it.
External Data has commands for importing data into Access and exporting it to other programs. You’ll also find features for integrating with Microsoft SharePoint Server. You’ll use these commands in Part 6.
Database Tools features the pro tools you’ll use to analyze a database, link tables, and scale up to SQL Server. You’ll also find the commands for inserting Visual Basic code, which you’ll explore in detail in Part 5.
If you have a scroll mouse, you can breeze through the tabs by moving the mouse pointer over the ribbon, and then rolling the scroll wheel up or down.
One nice ribbon feature is the way it adapts to different window sizes. In a wide Access window, there’s room to spread out, and text appears next to almost every button. But in a narrow Access window, where space is more limited, Access strips the text off less important buttons to make room (Figure 3).
Want to reclaim the screen real estate that the ribbon occupies? Just double-click the current tab, and the ribbon collapses, leaving only the row of tab titles visible. Double-click the tab again to pop the buttons back into sight.
If you’re a diehard keyboard lover, you’ll be happy to hear that you can trigger ribbon commands with the keyboard. The trick is to use keyboard accelerators, a series of keystrokes that starts with the Alt key (the same keys you used to use to get to a menu). When using a keyboard accelerator, you don’t hold down all the keys at the same time. (As you’ll soon see, some of them have enough letters to tie your fingers up better than the rowdiest game of Twister.) Instead, you press the keys one after the other.
The trick to keyboard accelerators is to understand that once you press the Alt key, you do two things, in this order:
Pick the correct ribbon tab.
In that tab, choose a command.
Before you can trigger a specific command, you must select the right tab (even if you’re already there). Every accelerator requires at least two key presses after you press the Alt key. You’ll need even more if you need to dig through a submenu.
By now, this whole process probably seems hopelessly impractical. Are you really expected to memorize dozens of different accelerator key combinations?
Fortunately, Access is ready to help you out with a feature called KeyTips. Here’s how it works: Once you press the Alt key, letters magically appear over every tab in the ribbon. Once you press a key to pick a tab, letters appear over every button in that tab. You can then press the corresponding key to trigger the command. Figure 4 shows how it works.
Don’t bother trying to match letters with tab or button names—the ribbon’s got so many features packed into it that in many cases, the letters don’t mean anything at all.
In some cases, a command may have two letters, and you need to press both keys, one after the other. You can back out of KeyTips mode at any time without triggering a command by pressing the Alt key again.
Some other shortcut keys don’t use the ribbon. These key combinations start with the Ctrl key. For instance, Ctrl+C copies highlighted text, and Ctrl+S saves your current work. Usually, you find out about a shortcut key by hovering over a command with the mouse cursor. Hover over the Paste button in the ribbon’s Home tab, and you see a tooltip that tells you its timesaving shortcut key is Ctrl+V. And if you’ve worked with a previous version of Access, you’ll find that Access 2013 keeps most of the same shortcut keys.
Keen eyes will notice the tiny bit of screen real estate that sits just above the ribbon (Figure 5). This bit of screen holds a series of tiny icons, and it’s called the Quick Access toolbar (or QAT to Access nerds).
If the Quick Access toolbar were nothing but a specialized shortcut for three commands, it wouldn’t be worth the bother. However, the nifty thing about the Quick Access toolbar is that you can customize it. In other words, you can remove commands you don’t use and can add your own favorites.
Microsoft has deliberately kept the Quick Access toolbar very small. It’s designed to give a carefully controlled outlet for those customization urges. Even if you go wild stocking the Quick Access toolbar with your own commands, the rest of the ribbon remains unchanged. (And that means a coworker or spouse can still use your computer without suffering a migraine.) However, Access also lets you get more radical by revising the arrangement of tabs, sections, and buttons in the ribbon. To learn how to customize the QAT and the ribbon, check out the appendix.
Your data is the star of the show. That’s why Access’s creators refer to databases as being on stage. Sure, it’s a strange metaphor, but the rationale for Access’s backstage view makes sense: It temporarily takes you away from your database and lets you concentrate on other tasks that don’t involve entering or editing data. These tasks include creating a new database, converting your database to a different format, printing part of its contents, and changing Access settings.
To switch to backstage view, click the File button that appears just to the left of the Home tab in the ribbon. To get out of backstage view, click the back arrow (shown in Figure 6) or press Esc.
Compact, repair, and encrypt your database file (choose Info)
Save a copy of your database (choose Save As)
Print some of the information in your database (choose Print)
Quit Access (choose Close)
Configure all sorts of Access options (choose Options) or change your user information (choose Account)
Access 2013 doesn’t bring the usual avalanche of new features. In fact, Microsoft took the exact opposite approach, and focused on streamlining and modernizing Access by kicking out some of its oldest and creakiest features. These changes have stirred up more than a little controversy among old-hand Access programmers, and much of it is justified. However, the ultimate goal—to make sure that Access remains a viable, thriving platform for businesses, individuals, and all kinds of data lovers—is a worthy one.
The most significant addition to Access 2013 is an Internet-enabled feature that Microsoft calls web apps (covered in Chapter 20). Web apps allow ordinary Access users to create databases that live on the Web, where hundreds or thousands of people can use them. Best of all, web apps require no extra skills beyond a basic knowledge of Access, and they are underpinned by Microsoft’s SQL Server data engine, ensuring good performance and offering the sort of data integration possibilities that make programmers drool. However, the tradeoffs are significant. Web apps have far fewer features than traditional desktop apps, and they require a SharePoint 2013 server to host them. Businesses that aren’t already using SharePoint 2013 may want to consider Microsoft’s Office 365 subscription plan (described in the box on The Office 365 Subscription Service), but the cost of licensing a team of people adds up quickly.
Access data projects. This nifty feature let Access experts create and manage SQL Server databases without leaving the comfort of Access. Its removal is the most controversial change in Access 2013. Now, Access fans who want to link Access and SQL Server together need to master SQL Server’s management tools, as described in Chapter 21.
The upsizing wizard. In the past, the upsizing wizard could take an overtaxed Access database and convert it to a SQL Server database. To do that now, you need the help of another tool, called SSMA. Fortunately, it’s free (Migrating an Access Database to SQL Server).
Support for Access 97 files. Access 2013 can’t open or convert Access 97 files. Sixteen years after Access 97 was first introduced, this shouldn’t come as much of a surprise. But if you still have an extremely old database kicking around, make sure you convert it using an older version of Access, like Access 2010 or 2007. In a similar vein, Access 2013 has finally given up on dBASE, which means you can’t import information from this long-dead database software either.
Pivot tables and pivot charts. Pivot tables and charts provided a powerful way to analyze huge quantities of data. However, the Access pivot table feature only had a subset of the full pivot table capabilities found in Excel. Now, Microsoft recommends that people who want to analyze their data do so in Excel. (Excel has a handy data connection feature that can grab the latest information from a database and insert it into a workbook.)
Data collection through email. This seldom-used feature let you send out an email form asking for data. Outlook would then take the replies and send the data to an Access table. The idea was good, but the implementation was awkward.
For the full list of discontinued features, including a few specialized, rarely used ones, go to http://tinyurl.com/afwls36 for Microsoft’s official rundown.
Despite the many improvements in software over the years, one feature hasn’t improved a bit: Microsoft’s documentation. In fact, with Office 2013, you get no printed user guide at all. To learn about the thousands of features included in this software collection, Microsoft expects you to read the online help.
Occasionally, these help screens are actually helpful, like when you’re looking for a quick description explaining a mysterious programming command. On the other hand, if you’re trying to learn how to, say, create a summary with subtotals, you’ll find nothing better than terse and occasionally cryptic instructions.
This book is the manual that should have accompanied Access 2013. In these pages, you’ll find step-by-step instructions and tips for using almost every Access feature, including those you haven’t (yet) heard of.
This book is divided into seven parts, each containing several chapters.
Part 1. In this part, you’ll build your first database and learn how to add and edit tables that store information. Then you’ll pick up the real-world skills you need to stop mistakes before they happen, browse around your database, and link tables together.
Part 2. In this part, you’ll build queries—specialized commands that can hunt down the data you’re interested in, apply changes, and summarize vast amounts of information.
Part 3. This part shows you how to use reports to take the raw data in your tables and format it into neat printouts, complete with fancy formatting and subtotals.
Part 4. In this part, you’ll build forms—customized windows that make data entry easy, even for Access newbies.
Part 5. Now that you’ve mastered the essentials of databases, you’re ready to delve into the black art of Access programming. In this part, you’ll use macros and Visual Basic programming to automate complex tasks and solve common challenges.
Part 6. In this part, you’ll learn to let groups of people use your database at the same time. You’ll start by learning how to split your Access database and host it on a network. Then you’ll consider other options, such as putting your database online in a web app, or linking your database to SQL Server or SharePoint. Finally, you’ll learn about the import and export features that can transport data into your database and copy it to other types of files.
Part 7. This book wraps up with an appendix that shows how to customize the ribbon to get easy access to your favorite commands.
Throughout this book, you’ll find sentences like this one: “Choose Create→Tables→Table.” This method is a shorthand way of telling you how to find a feature in the Access ribbon. It translates to the following instructions: “On the ribbon, click the Create tab. On the tab, look for the Tables section. In the Tables box, click the Table button.” (Look back to Figure 2 to see the button you’re looking for.)
As you saw back in Figure 3, the ribbon adapts itself to different screen sizes. Depending on your Access window’s size, the button you need to click may not include any text. Instead, it shows up as a small icon. In this situation, you can hover over the mystery button to see its name before deciding whether to click it.
If you resize the Access window so that it’s really small, you might run out of space for a section altogether. In that case, you get a single button that has the section’s name. Click this button, and the missing commands appear in a drop-down panel (Figure 7).
Although nice, predictable tabs are a great idea, some features obviously make sense only in specific circumstances. Say you start designing a table. You may have a few more features than when you’re entering data. Access handles this situation by adding one or more contextual tabs to the ribbon, based on your current task. These tabs have additional commands that are limited to a specific scenario (Figure 8).
When dealing with contextual tabs, the instructions in this book always include the title of the tab section (it’s Table Tools in Figure 8). Here’s an example: “Choose Table Tools | Fields→Add & Delete→Text.” Notice that this instruction’s first part includes the contextual tab title (Table Tools) and the tab name (Fields), separated by the | character.
From time to time you’ll encounter buttons in the ribbon that have short menus attached to them. Depending on the button, this menu appears as soon as you click the button, or it appears only if you click the button’s drop-down arrow, as shown in Figure 9.
When dealing with this sort of button, the last step of the instructions in this book tells you what to choose from the drop-down menu. For example, say you’re directed to “Home→Views→View→Design View.” That tells you to select the Home tab, look for the Views section, click the drop-down part of the View button (to reveal the menu with extra options), and then choose Design View from the menu.
Be on the lookout for drop-down arrows in the ribbon—they’re tricky at first. You need to click the arrow part of the button to see the full list of options. If you click the other part of the button, then you don’t see the list. Instead, Access fires off the standard command (the one Access thinks is the most common choice), or the command you used most recently.
When you see an instruction that includes arrows but starts with the word “File,” it’s telling you to go to Access’s backstage view. For example, the sentence “Choose File→New” means click the File button to switch to backstage view, and then click the New command (which appears in the narrow list on the left). To take another look at backstage view and the list of commands it offers, jump back to Figure 6 on The Quick Access Toolbar.
As you’ve already seen, the ribbon has taken the spotlight from traditional toolbars and menus. However, in a couple of cases, you’ll still use the familiar Windows menu, like when you use the Visual Basic editor (in Chapter 18). In this case, the arrows refer to menu levels. The instruction “Choose File→Open” means “Click the File menu heading. Then, inside the File menu, click the Open command.”
Every time you take your hand off the keyboard to move the mouse, you lose a few microseconds of time. That’s why many experienced computer fans use keystroke combinations instead of toolbars and menus wherever possible. Ctrl+S, for one, is a keyboard shortcut that saves your current work in Access (and most other programs).
When you see a shortcut like Ctrl+S in this book, it’s telling you to hold down the Ctrl key, and, while it’s down, press the letter S, and then release both keys. Similarly, the finger-tangling shortcut Ctrl+Alt+S means hold down Ctrl, then press and hold Alt, and then press S (so that all three keys are down at once).
As the owner of a Missing Manual, you’ve got more than just a book to read. Online, you’ll find example files so you can get some hands-on experience, as well as tips, articles, and maybe even a video or two. You can also communicate with the Missing Manual team and tell us what you love (or hate) about the book. Head over to www.missingmanuals.com, or go directly to one of the following sections.
As you read this book, you’ll see a number of examples that demonstrate Access features and techniques for building good databases. Most of these examples are available as Access database files in a separate download. Go to to www.missingmanuals.com/cds/access2013mm, where you can download a Zip file that includes the examples, organized by chapter. And so you don’t wear down your fingers typing long web addresses, the Missing CD page also offers a list of clickable links to the websites mentioned in this book.
If you register this book at oreilly.com, you’ll be eligible for special offers—like discounts on future editions of Access 2013: The Missing Manual. Registering takes only a few clicks. To get started, type http://oreilly.com/register into your browser to hop directly to the Registration page.
Got questions? Need more information? Fancy yourself a book reviewer? On our Feedback page, you can get expert answers to questions that come to you while reading, share your thoughts on this Missing Manual, and find groups for folks who share your interest in Access. To have your say, go to www.missingmanuals.com/feedback.
In an effort to keep this book as up to date and accurate as possible, each time we print more copies, we’ll make any confirmed corrections you’ve suggested. We also note such changes on the book’s website, so you can mark important corrections into your own copy of the book, if you like. Go to http://tinyurl.com/acc2013-mm to report an error and view existing corrections.
Safari® Books Online is an on-demand digital library that lets you easily search over 7,500 technology and creative reference books and videos to find the answers you need quickly.
With a subscription, you can read any page and watch any video from our library online. Read books on your cellphone and mobile devices. Access new titles before they’re available for print, and get exclusive access to manuscripts in development and post feedback for the authors. Copy and paste code samples, organize your favorites, download chapters, bookmark key sections, create notes, print out pages, and benefit from tons of other timesaving features.