IsDev Function
By Richard Rost
2 years ago
ACCDB or ACCDE File Usage Indicator in Access
In this Microsoft Access tutorial, we will create an IsDev function to indicate whether the developer is using the ACCDB file or an ACCDE file.
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
Links
Recommended Courses
Keywords
TechHelp Access, ACCDB vs ACCDE, IsDev function, developer mode, VBA programming, Access security, file extension check, developer menu, database encryption, compact and repair, secure Access database, Access user level security, front end back end split, Access maintenance, Global Module, Boolean check in Access
Subscribe to IsDev Function
Get notifications when this page is updated
Intro In this video, I will show you a quick developer tip for Microsoft Access: how to create an IsDev function to determine if your database is running in developer mode (ACCDB) or as a user-distributed ACCDE file. We will walk through building a simple VBA function that checks the file extension, discuss why this is useful, and cover some quick notes about the limitations of this method when it comes to security and maintenance. This straightforward approach is handy for showing extra developer options or diagnostic information while keeping things easy for both you and your users.Transcript Today's video is just a quick tip. I'm going to share something one of my students shared with me. He's found a quick way to determine whether you're in developer mode. In other words, are you the developer working with the ACCDB file, or is it one of your users using an ACCDE file, which is what all your users should have, right? I'll talk about this in a moment.
Recently, in one of my videos, the "Force Shutdown" video, I showed you how to force the database to close down so you can, for example, set it to automatically close at 5 AM every day, just in case someone left the office without logging off. However, you might not want to be logged out yourself; you might want to ensure that only the developer, or the admin, doesn't get booted out.
I've demonstrated several techniques for setting up user logins, security, and more. But one of my students, Thomas, came up with an ingenious method to determine whether you're working with the ACCDB file or not. In other words, if one of your users has an ACCDE file, right? He set the temp variable like this. I'm going to show you how to build a simple function to do this, but it's essentially the same technique, so a big shoutout to Thomas for the idea.
Before we dive into it, though, let's clarify: this is a developer-level video. What does that mean? Well, if you've never programmed in VBA before, I highly recommend watching this video first. There's a little QR code you can scan right there; it teaches you everything you need to know to get started in about 20 minutes. Also, watch this video on creating your own function, this video on the "if then" function, and this video on what an ACCDE file is if you've never split your database before. Oh, wait, I've got a video for that too. Here's my "Split Your Database" tutorial. Of course, you should always split your database in a multi-user setup. Don't have multiple people working on the same front end. Every user gets their own copy of the back end file, which is just a copy of your ACCDE file.
So, here I have the master database, my ACCDB file, the one I work on to make changes. Then, just a copy of my tech help free template, this free database you get when you want to... Let's make a function to indicate whether or not I am working with an ACCDB file. How can we do that? We're going to check the file name.
This file's name is going to be a full path, like "C:\whatever\my desktop\db.accdb". We can get that from the current project group of properties. So, let's go down here to Global Module. If you don't have a Global Module set up already, just go to Create, and then Module (not Class Module, Regular Module). That'll open up the VB Editor. There it is. Every... Come right down here, and we're going to create a public function.
We'll call it "IsDev", nice and short. It's not going to take any information in, so no incoming parameters, and it's going to return a Boolean value (Bool). Boolean is a true/false value, otherwise known as a yes/no field in Access. Now, all we're going to do is check the right five characters of the full path and file name.
If that comes out as ACCDB, then we know we've got the developer copy. So, if the right of current project.full name, comma five, equals ACCDB, then IsDev equals True; otherwise, IsDev equals False. Real straightforward, right? It's either that or it's not. Alright, let's save that, give it a debug compile.
Looks good. Now, let's test it. So, I'm just going to put some code in my Hello World button. Design view, right-click, build event, and we can come in here and say if IsDev, then (we don't need to put "= True", right?). By default, equals true is what we're looking for. Then we're going to status "is developer". Otherwise, we'll status "is not developer". Alright, and status is my little status function. That's way up top here; I covered this in the tech help free template video. It just basically writes to that big gray box on the main menu.
Okay, save it again, debug compile. Let's go back out here, let's close it, open it back up again, click the button, and now I am in developer mode, right? That way, the database knows it's the developer's time. Now, let's make the ACCDE file. If we were to actually split the database, where you put your tables in one thing and your forms and stuff in another, you would split it and you'd give the front end ACCDE file to your users. That's all explained in those other videos. But for now, we'll just make an ACCDE out of the whole thing, alright?
So, file, Save As, ACCDE, right there, Save As. Alright, what are you going to call it? ACCDE is fine. And then hit save. And it'll do some stuff. And then you'll end up with this little guy. It's an ACCDE file, right?
It's the execute-only or encrypted. I've seen different definitions for it. But now if you come in here and click the button, not in developer mode because this is the ACCDE file. It's literally just looking at the file name. Now, why would you need this? Well, if you don't have full user security in your database with user logons, or you don't want to go through the trouble of checking the PC name, which I also talk about in my other video, you can look at the name of the computer, the name of the logged-on user, there's all kinds of things you can do. But if you don't want to do any of that, and you just care about whether or not it's you or one of your end-users, then this technique is nice and short and simple.
But I would only use this for maybe displaying some extra diagnostic information, or if you want to have a developer menu that's got buttons on it for routine maintenance type stuff, like backups, compact, and repair, extra diagnostic logging, that kind of stuff. Don't put anything secure in here, because this is not a secure method. This is just a quick method to maybe hide some stuff that you don't want your end-user seeing, but it's not a big deal if they do see it because this is how easy this is to break. You can just come in here and rename this front-end file. If I call it, let's say, db2.accdb, right, hit enter, you get the, you're going to change file extension, yeah, that's okay. And so now I've got db2.accdb and if I open this one up and I hit Hello World, it is developer now. Even though it's still an ACCDE file, in other words, if I come in here, I still can't go into design view, right
? It's still, the file's still locked down. Still can't open up the VBA and stuff like that. But your end-user, if they know enough, can still rename the file. So don't rely on this technique for anything sensitive, right? If you do want more in-depth security I got a couple of free videos. I cover user-level security, actually setting up usernames and passwords. Not that hard to do but it takes a little bit of work. I also have another video here that walks you through some simple security measures to protect your database from 90% of users out there. You know if unless they're a hacker unless they know access well. If it's just your typical office user this stuff is good enough. And once you got that stuff set up you can track the user logon you can track what they're doing inside your database to this technique here I just use the computer name and the person's username on windows so you don't have to set up a logon password if you want to just have them
so it just recognizes their computer now by its very nature access itself is not designed to be a secure database if you really really need security you want to take your back-end data, your tables and stuff, you want to put those in a database server like SQL Server. Okay, but I have my security seminar which teaches you how you can make your access database as secure as possible. Okay, and we can take your front end, we can lock it down, we can prevent your users from getting into stuff that you don't want them to see, and we create a system log, all that kind of stuff.
So check this out if you really want to make a secure solution. And again, if you move your data to SQL Server, then you've got a really good bulletproof tight database set up. My SQL Server online seminar shows you how you can set it up so that you can share it with people around the world too. So anybody anywhere with a copy of your Access Front End can log into your database and you can get information to a webpage or any kind of other stuff that you want. And of course, if you like learning with me, if you enjoy my wacky sense of humor and like my videos, check out my developer courses. I got lots of them. Lots of stuff to keep you busy learning Microsoft Access. So there you go. There is your tech help video for today. Again, shout out to Thomas. Thanks for the idea for the video. I hope the rest of you learn something. Live long and prosper my friends. I'll see you next time.Quiz Q1. What is the main purpose of the "IsDev" function discussed in the video? A. To determine if the database is in developer mode by checking the file type B. To create a user login system for added security C. To automatically backup the database every day D. To force the database to shut down at specific times
Q2. What file type should end-users of your Access application typically receive? A. ACCDB B. MDB C. ACCDE D. LACCDB
Q3. How does the "IsDev" function determine if you are in developer mode? A. By checking the username of the person logged in B. By checking the right five characters of the full file name for ACCDB C. By prompting the user to enter a password D. By verifying the Windows computer name
Q4. Why is the method of checking the file extension not secure for sensitive features? A. Users can bypass security by renaming the file extension B. It only works on specific versions of Access C. It requires administrator rights D. ACCDB files are always vulnerable to viruses
Q5. What is the recommended approach for a multi-user Access database setup? A. Give everyone access to a single ACCDB file on a shared drive B. Each user should have their own copy of the ACCDE front end linked to a shared back-end C. Only provide read-only copies to users D. Use only ACCDB files and never split the database
Q6. What is a suitable use for the IsDev function according to the video? A. Providing full database security B. Hiding extra diagnostic menus or buttons from end-users C. Encrypting the entire database D. Backing up the database to cloud storage
Q7. What does splitting your Access database refer to? A. Breaking the file into multiple smaller databases for performance B. Separating tables (back end) from forms, queries, and code (front end) C. Saving the file in ACCDB and MDB formats simultaneously D. Creating duplicates for version control
Q8. What does the ACCDE file extension indicate about an Access database? A. The database is read-only and cannot be opened B. It is the developer version that allows design changes C. It is an execute-only version with locked code and forms D. It supports only SQL Server connections
Q9. According to the video, where can more advanced and secure user logins best be managed? A. Within an Excel spreadsheet B. Inside an ACCDE file using the IsDev function C. Using built-in Access password protection only D. By creating a user-level login system or moving tables to SQL Server
Q10. Why is Access generally not considered highly secure for sensitive data? A. Because it cannot create ACCDE files B. Because built-in security measures are easy to circumvent for knowledgeable users C. Because it only works on Windows computers D. Because it does not allow multiple users
Answers: 1-A; 2-C; 3-B; 4-A; 5-B; 6-B; 7-B; 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.Summary Today's TechHelp tutorial from Access Learning Zone brings you a handy tip that one of my students recently shared with me. This technique offers a quick way to determine whether you are operating in developer mode within your Access database. In other words, it helps you identify if you are working directly with the ACCDB file as a developer, versus running the ACCDE file as a user. Remember, your end-users should always be working from an ACCDE file, and I will touch on that in a moment.
Not long ago, in my Force Shutdown video, I showed you how you can automatically close your database at set times, such as at 5 AM, to ensure your application is not left open if someone forgets to log off. Of course, you might want to make sure that only the developer or admin is exempt from getting logged out in these situations.
Over the years, I have shown a variety of approaches to set up user logins and different security options. However, Thomas, one of my viewers, discovered an especially clever way to determine which file is open: ACCDB for developers or ACCDE for your regular users. His method involves using a very simple check that looks at the extension of the current file name.
Before explaining further, let me be very clear: this is an advanced, developer-level topic. If you are not yet familiar with programming in VBA, I recommend starting with my introductory video on the subject. It is around twenty minutes and will give you the basics. I would also suggest watching my tutorials on creating your own custom functions, using If...Then statements, understanding ACCDE files, and learning how to split your Access database for multi-user environments. It is important to remember that you should never have multiple people sharing a single front-end file. Every user gets their own copy of the ACCDE file as their front-end, while the back-end (holding your tables) remains on a shared location.
Here is the process. I maintain a master ACCDB file to develop and update my application. My end-users, on the other hand, only receive compiled ACCDE files, which prevent them from entering the design environment or modifying VBA code.
To programmatically check if I am currently in developer mode, I wrote a function that simply examines the extension of the database's full file name. Access exposes this information through the current project properties, which include the full path and file name. By evaluating the last five characters of this string, I can easily tell if the file ends with ACCDB. If it does, I know that I'm working in the developer file.
To set this up, I create a public function named "IsDev" that returns a Boolean value. The function checks whether the file extension is ACCDB and returns True if it is. This makes it simple to display a message or enable certain developer-only functionality whenever I run specific commands or click a button.
I typically test this by adding a check to a button's event, where I display a message indicating whether or not the database is in developer mode. For those following along with my free template, you'll know that I use a status message area to display such feedback.
After saving and compiling the code, I open the database and click my test button. If I am in the developer ACCDB file, the message confirms developer mode. To simulate the user experience, I then save the database as an ACCDE file. When I open this new ACCDE version and press the button, the message indicates that I am not in developer mode. This verifies that the check works as intended.
This approach is quite effective if you do not want to implement more advanced user security, such as setting up logins or checking the computer name. It is a fast and simple way to distinguish developers from end-users for things like showing diagnostic tools, routine maintenance options, or extra logging in your application. However, I must stress that it is not a secure solution. Someone could simply rename the file extension to trick the function, so do not use this for anything requiring real protection. Think of it as a convenience tool for behind-the-scenes features, not for locking down sensitive functions.
If you need stronger security, I have several free videos that walk you through methods such as setting up usernames and passwords, along with ways to track user activity. These techniques offer much better real-world protection and help prevent most casual users from accessing areas they shouldn't.
For those who require maximum data security, consider storing your back-end data in a dedicated database server, such as SQL Server. Access is not designed as a highly secure environment; moving your tables to a database server makes it much harder for anyone to tamper with your data. My security seminar provides in-depth instruction on how to make your Access database as secure as possible, including system logging and locking down the front end. In my SQL Server online seminar, I cover how to set up robust solutions for accessing your data from anywhere in the world.
If you enjoy learning in this format, I have a wide range of developer courses on all aspects of Microsoft Access. There is always something new to explore and plenty of techniques to help you build better databases.
That wraps up today's TechHelp tutorial. Special thanks to Thomas for inspiring this tip. You can find a complete video tutorial with step-by-step instructions on everything discussed here on my website at the link below. Live long and prosper, my friends.Topic List How to determine if an Access database is ACCDB or ACCDE Creating a public function in a Global Module Using CurrentProject.FullName to get the file name Checking the file extension using VBA string functions Returning a Boolean value from a function in VBA Implementing developer-only features using the ACCDB check Assigning custom status messages based on developer mode Testing the IsDev function in a button event Saving an Access database as an ACCDE file Limitations of using file extension to determine security
|