Application Parts
By Richard Rost
2 years ago
Creating Database Application Parts in Microsoft Access
In this Microsoft Access tutorial, I'm going to teach you how to create an application part, which is a bundle of related objects that you can quickly import into an existing project. For example, if you like to keep all your customer and contact stuff together, you can create an application part for it. Then, with a few clicks, import all the tables, queries, forms, reports, and related code.
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!
Keywords
TechHelp Access, application parts,creating application parts,ACCDT templates,database packaging,customer table,contact queries,import tables,form reports,table relationships,referential integrity,save as template,setup primary table,relationship wizard,module inclusion,customer and contacts app part,template customization,Access tutorial.
Intro
In this video, we will talk about how to create and use application parts in Microsoft Access to quickly add reusable groups of objects, like related tables, queries, forms, and reports, into your databases. We'll cover how application parts differ from ACCDT templates, how to package specific sections of your database for reuse, which objects to include, maintaining table relationships, and tips for importing and managing these components in other databases. You'll also see how Access handles relationships and customizations when bringing in an application part, as well as practical considerations for backing up your templates.
Transcript
In today's video, we're going to talk about application parts and how to create them to quickly add commonly used objects to your Microsoft Access database. This will be an expert-level video, which is a little bit more advanced than beginner but not quite up to developer level, so we don't need any VBA programming today.
So in yesterday's video, we talked about ACCDT templates and how you can package up an entire database. And then, if you want to send it to someone else, or if you want to make copies of that yourself quickly and easily, you can package it up into a template. Well, sometimes, you might have parts of your database that you might want to do that for. Not the whole database itself, but just certain parts that you might reuse on a regular basis. Let's say your customer stuff: Your customer table, some queries that go with it, a form, a report, that kind of stuff. You can package up just certain pieces, certain objects in that database, and that's what a database part is, or an application part.
So let's say here's my TechHelp free template. Let's say just the customer stuff. So the customer table, maybe I got some related customer queries here, some customer forms in here. Let's pretend I had some reports, maybe a module or so. Now normally, you could just import this stuff if you wanted to, you know, open up both databases side by side, even just drag them over from one to the other. I've shown how to do that in a couple of different videos.
But one of the nice things about application parts is that they will maintain relationships between the tables as well. So let's say you want to do customers and contacts. You want to make an application part about that. Remember, contacts are when you talk to a customer. Every time you talk to me, you put a note, like a journal, in here. That's what I consider a contact to be. I know some people say contacts are people. Yeah, it's terminology, folks. So for me, a contact is every instance that I talk to them.
So let's say, in my other databases that I build, let's say I'm building a database for client A, and he's like, well, okay, I want customers and contacts. Okay, great, I got that as an application part. I can just quickly and easily pull that into my database.
So we're going to set it up the same way we would normally set up a template, like we did yesterday, but we're going to remove anything from here that we don't want with this bundle of stuff. So I'm going to keep just the customer and the contacts. So I'll delete all the order stuff. Order stuff can go. Let's see, this order stuff can go, these blank things can go, that's contacts and customers. I can see what you're in the main menu, this stuff here. I'll delete this, delete that, delete this, and we'll keep our... No, I'm going to get rid of the global module because usually in an application part, you've already got that in the database. So, you just want to pull in the stuff you want that are related to customers and contacts.
Obviously, if you've got customer or contact related code that you always use like, you know, verify email address or something like that, and it's not in your global module, you could have a module that you do bring in. But I'm going to get rid of all these objects. Okay, so that's just the stuff I'm keeping. That's just the stuff related to customers and contacts. Okay.
Now, in this particular database, I don't think I have any relationships set up because it's my training database, and I put the relationships in here when I'm covering relationships, but normally I don't use relationships myself. Very, very rarely do I ever use database-level relationships. And I explain why in my relationships video. So if you want to hear more about it or you need to learn about relationships yourself, go watch this video. I'll put a link to it down below.
So let's set up a relationship real quick. I'll go to Database Tools, Relationships. I'm going to bring in customers and contacts and I'll make a relationship between the customer ID to that one there. We'll do referential integrity and cascade delete related records, which is dangerous, but just for demonstration purposes we'll do that. Save it, close it, and now we're going to save this as a template. So just like we did yesterday, File, Save As, make Save as.
Alright, this guy pops up. Let's call this RIC's customers and contacts app part or whatever. Description goes there. User templates is fine. If you want an icon and a preview, all that, that's fine.
Now, down here we're going to check application part. Once you do that, you can set up this thing here called a primary table. I never use this, to be honest. When you import this stuff into your database, it'll try to help you create relationships between the other tables based on your primary table. There's usually application parts. There's a primary table, like the customer table. Personally, I find this whole process confusing. I would much rather just make the relationships after I've imported my parts myself.
Okay, so I never use that. But if you want to use that go ahead and play with it. You can set something up like the customer key, and then when the wizard runs when you pull these parts in, it'll ask you what you want to set up relationship-wise. I never use that myself so I skip that.
Okay, again, instantiating a form if you wanted to run a particular form, open a form when you pull the part in so you can do some setup stuff or whatever, that's up to you. Again, I never use that. If you want to include the data, great; if not, it comes in empty. Alright, you ready? Hit okay. It does its little thing, and once again, it saves it in this spot here. So, if you want to share this with someone else, that's where you've got to go digging. Alright, but usually, application parts are stuff I save for myself. Alright, just make sure if you've got stuff in here and you don't want to lose it, if you're not doing a full system backup, make sure you add this folder to your backup routine. Alright, you've got stuff in there you don't want to lose.
Okay. All right, so we're done. We've set up the application part. There's now a template sitting in that folder. I can now delete this.
Okay, so let's create a brand new blank database. I'm going to open up Access, just open up regular old Access, create a blank database from this guy here. Alright, Database 7, whatever, that's fine, I don't care. Alright, here I am in a blank database, and I can tell it's a new blank database, and I hate it because it's got the tabbed interface on it instead of the overlapping windows. Everyone always asks me about that. If they just come across one of my videos and it's the first video they watch, they always ask, why do you not have the tabs across here? Because I like overlapping windows. I like this, old-school design, right, where each form is a window, each report is a window. That's my preference. If you want to set it up yourself, there you go.
But anyways, okay, let's pretend, you know, you're building your database, you've got a couple of tables set up, you've got a couple of fields set up, that's fine. Save changes, yes, all right. I've got table one in here. Whatever other objects you've built in this database. And then you say to yourself, oh, you know what? I kind of need some customers and contacts stuff added to this database. So, I've got an application part already set up for that. I can just pull that stuff in.
All right, so we're going to go to Create, and then over here is Application Parts. Drop that down. Here's one I was playing with earlier, basically the same thing. And here's the new one I just created, Rick's customers and contacts app part. Click on that, a little wizard runs, it'll process it. Okay, pulls it in. You're going to get a security warning unless, you know, that other database was from a trusted location, which I'm not sure if it is or not. You just enable content, it'll load it.
Okay, and there are your parts that you brought in. Now you get your customer form. See, and see, it doesn't keep your fonts and stuff. It put you, I think it put you to the new, what is the new, Aperçu or whatever it is? Yeah, see, it doesn't keep this up. This is one of the reasons why I prefer just using my TechHelp free template. I take this guy, I copy it, I modify it. I've been doing that for 30 years. So, I personally don't really use this stuff as far as application parts and stuff go, or even templates. But you guys ask me about it all the time, so I have to show you. But this is one of the reasons why it doesn't keep all of your customizations.
And if you look, if you open up the customer T, okay, let's put some data in here, blah, blah, blah, blah, blah. And okay, so there's that, the subdatasheet comes in there just fine. Sometimes it doesn't turn on the subdatasheet. Sometimes you won't see the related contacts table in there, but it does keep the relationship for you. So that's one of the benefits of the application parts, it keeps all your relationships if you like to use them.
If not, if you don't see the subdatasheet, just come into here, into design view, go to the property sheet, and this is where you can set up the subdatasheet over here. And it's got it automatically, but you can specify which one it is. This is a setting that you use, and I did a video on this too. You might have your customer table related to multiple other tables, like contacts, orders; they can all be related to customers. You can pick in here which table is in the subdatasheet.
And this is just for you; remember, this is not for your end users. We never let our end users play with our tables directly. We hide this stuff, and we make them work with forms that have subforms in them, and you can control what they do. This is just for you if you want to quickly come in here and see some stuff.
Alright, there you go. That's application parts. Not that difficult to use. Again, it's a feature I never use personally myself. I just, you know, have to show you guys how to use it because some of you have told me in comments before, because I cover this in my full course, some of you have said, yeah, it's pretty nifty. I use it a lot. You can use it for stuff that's like, you know, maybe you got an email system. It's an email form and some tables and maybe some code that's just for sending emails. And not every database you build is going to need sending emails. But let's say you're designing something for a customer, and they say, oh man, it would be great if you could send emails from the database. And you're like, oh, I've got that already built. Make it an application part. You can easily bring it in if that's what you want to do.
Alright, if you like learning this stuff with me, come on by my website, check it out. No matter what your skill level is—beginner, expert, advanced, developer—I've got all kinds of stuff in here for you. You name it, I got it. It's in there. It's like that spaghetti sauce. What is it? Prego? Ragu? One of those? It's in there.
And if you do search for something Microsoft Access related, you have a question, you Google it, you search on YouTube, whatever. If one of my videos doesn't come up, I want you to tell me about it. I want to know. I want to show up in the top search spot for every Access-related topic. That's my goal. That's my goal for 2024. New Year's resolution.
Alright, but that's going to be your TechHelp video for today. I hope you learned something. Live long and prosper, my friends. I'll see you next time.
TOPICS: Creating application parts in Access Using ACCDT templates for databases Packaging database parts for reuse Objects that can be part of application parts Importing objects between databases Importing tables with maintained relationships Defining contacts within a database Deleting unrelated objects for application parts Setting up database-level relationships Configuring referential integrity and cascade delete Saving a customized segment as a template Choosing application part and primary table settings Specifying a form to instantiate upon part import Including data in application parts Locate the saved template for sharing or backup Creating a new blank Access database Changing interface from tabbed to overlapping windows Using the Application Parts feature in Access Running the wizard to import application parts Enabling content for security warnings Handling customizations that are not preserved Verifying relationships and subdatasheets are intact Adjusting subdatasheet properties for related tables Application of application parts in different scenarios
Quiz
Q1. In Microsoft Access, what is an application part? A. A full backup of an Access database B. A pre-defined set of Access functions C. A packaged subset of database objects that can be added to other databases D. A Visual Basic for Applications (VBA) code module
Q2. When would you use an application part in Access? A. When you want to import a whole database into another one B. When you want to reuse certain parts like customer tables and queries across different databases C. When you need to write new VBA code for a database D. When you are setting up a relationship between two unrelated tables
Q3. What advantage do application parts have over simply importing objects? A. They create a backup of the original database B. They allow for version control of objects C. They can maintain relationships between tables D. They automatically convert queries into reports
Q4. Can application parts include VBA modules? A. Yes, if they contain customer or contact related code that you always use B. No, application parts are strictly limited to tables, queries, forms, and reports C. Yes, but only if they are unrelated to customers and contacts D. No, VBA modules are shared across all databases and cannot be part of an application part
Q5. What do you need to do if you want to keep the relationships when setting up an application part? A. You need to set your database to archive mode B. You need to create a duplicate of the tables you are including C. You need to set up a relationship in the original database before creating the part D. You need to manually write a script that maintains the relationships
Q6. How can you identify a primary table when creating an application part? A. It is automatically determined by the most used table in the database B. You can select it during the application part saving process, but it is optional C. It is the first table you import into your new database D. It is required to set up a primary table to make an application part
Q7. Why might you choose not to include a module in an application part? A. Because the database where you import the part will likely have a global module already B. Because modules do not contain data relevant to customers and contacts C. Because all modules are automatically included in every application part by default D. Because modules can only be imported separately as they contain sensitive information
Q8. What format does the application part get saved in? A. ACCDB B. ACCDT C. XML D. MDB
Answers: 1-C; 2-B; 3-C; 4-A; 5-C; 6-B; 7-A; 8-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.
Summary
Today's TechHelp tutorial from Access Learning Zone focuses on the concept of application parts in Microsoft Access and how you can use them to quickly add commonly used objects to your databases. This lesson is designed for users who are comfortable with Access but are not quite at the level where VBA programming is necessary.
In a previous tutorial, I discussed ACCDT templates, which allow you to package an entire Access database for easy duplication or sharing. However, there are situations where you only need to reuse certain key sections of your database rather than the whole thing. For example, you might frequently use a set of customer-related objects such as a customer table, related queries, forms, and reports. In these scenarios, application parts are ideal because they let you bundle just these items together for reuse, rather than exporting or re-importing entire databases.
Let's use my TechHelp free template as an example. Imagine you want to grab only the customer-related components — that might include the customer table, related queries, any relevant forms, and perhaps reports or a specialized module. Although it's possible to import these objects by hand, application parts offer some specific advantages. One key benefit is that, unlike manual import, application parts will keep all table relationships intact when copied to another database. For instance, if you have customers and contacts tables with defined relationships, and you want to use this setup in a different project, an application part preserves those relationships in the target database.
To prepare an application part, you need to pare down your database to only the objects you want to include. Remove any extraneous tables, forms, reports, or modules that you do not want packaged. If you have code specifically tied to customers or contacts and it is not in your existing global module, you can include a corresponding module in the application part; otherwise, you can leave it out.
In my example, I demonstrate trimming the database down to just the essentials: the customers and contacts tables, the relevant forms and queries, and nothing else. In training databases, I generally do not set up database-level relationships except when specifically teaching those concepts. However, relationships are important if you want to maintain referential integrity between, say, your customers and contacts data.
At this point, you can access the Relationships tool, add the relevant tables, and establish relationships as needed. You can set referential integrity, and if necessary, configure cascading deletes, though you should use caution with this feature.
After setting up the relationships, the next step is to save your selection as a template. Within Access, you do this just as you would save a regular database template. Choose to save it as an application part, give it a meaningful name and description, and decide whether to set a primary table, which can facilitate relationship creation when importing the application part. In practice, I find the primary table feature confusing and generally handle relationships after importing the objects, but it's available if you want to experiment with it.
If you want the application part to open a specific form upon being imported, that option is available, but it's purely up to your workflow. Similarly, you can decide whether to package the data itself or just bring in the structure. Once you've made your selections and confirmed, Access creates the application part template and saves it into your user templates folder. Remember to include this folder in your backups if you're going to rely on it for storing reusable components.
With your application part created, it's now ready to be brought into any new or existing Access database. If you open up a brand-new blank Access database, you can pull in the application part using the Create menu's Application Parts option. From here, just select your saved part, and Access will guide you through the import process. You may encounter a security warning if your template comes from an untrusted location, but you can enable the content and proceed.
The imported objects will appear in your database ready to use. You may notice, however, that certain customizations such as fonts or layouts may not transfer exactly as they appeared in the original database. This is one of the reasons I personally tend to prefer working from a master template and copying directly, but application parts definitely have their place, especially if you want to maintain relationships between imported tables.
To check or modify how related tables display, you can access table design settings and adjust the subdatasheet properties, specifying which related table you want to appear in the datasheet view. This is an internal convenience for you as the developer — end users should never work with raw tables directly. They should always interact with your forms, and you control their access and interactions through layered form design.
Application parts can be particularly useful for modular features that you do not use in every project. For example, if you have an email component that includes a form, related tables, and code just for sending emails, you can package this as an application part and import it into client databases only when required.
If you want more training on Access — whether you are a beginner, an expert, or working your way to advanced developer level — I invite you to visit my website. There you will find a complete video tutorial with step-by-step instructions on everything discussed here.
Live long and prosper, my friends.
Topic List
Creating application parts in Access Packaging specific objects for reuse Selecting objects to include in application parts Deleting unrelated objects from the application part Setting up relationships between tables Configuring referential integrity and cascade delete Saving a set of objects as an application part template Setting the application part and primary table options Choosing to instantiate a form when importing Including or excluding data in application parts Locating the saved application part template Creating a new blank Access database Importing application parts into a database Enabling content for security warnings after import Reviewing imported forms, tables, and queries Verifying and maintaining relationships after import Checking subdatasheet connections for related tables Adjusting subdatasheet properties in table design view Applying application parts to new projects
|