How to Customize Access Databases – Follow Up

How to Customize Your Access Database Applications – Follow Up

In an earlier access tutorial I showed how to create a customized start ‘splash’ screen or pop up window that was set to open when the database application was opened. Now I will give a follow up to that which shows how to further customize your access database application. So, the first thing that you will want to change or customize is the title of the database, which appears in the upper window. By default, Access places simply the file name of the database in the title bar, but you may want something other than that, so here is how to change that. First click on the ‘Home’ tab at the top, and from the home tab, click on the ‘options’ menu on the left hand side of the screen. Now on the options menu that pops up, the first thing to do is to click ‘current database’ to make sure that you are making changes to the current database. Here is what the menu looks like:

Access - Shane Zentz

Access – Shane Zentz

Here is where you can change the text in the title of your application, simply add your own text. Also you’ll notice that you can also add your own icon for the current database. If you have a 32 x 32 pixel .ico file that you would like to see in the taskbar area when your database application is running, then just click on the box and navigate to it and Access will add it automatically. You also have the option to make this icon the icon for the forms and reports in your database. These two things go a long way in allowing you to customize your access database application.

One more thing you can control from this screen is whether you want the user of your database program to have access to the navigation pane on the left hand side of the database application. This navigation pane is displayed by default and contains menus for tables, forms/reports, and queries. However there are times when you do not want a user of your access database application to have access to these things. The solution is to de-check the ‘display navigation pane’ checkbox as seen here:

Access - Shane Zentz

Access – Shane Zentz

This does not block the user completely from, say, opening up a table that you don’t want them to access and altering data, but most users will be unsavy enough to never realize that they can simply open the options menu for the database and check the ‘display navigation pane’ checkbox to have access to the navigation pane. So this will be an easy and effective way to block access to things like tables and forms that you dont want other users figeting around with.

Thanks for reading this post,
Look for more Access Tutorials to come soon……………………………………

How to Password Protect a Form or Report in Microsoft Access

How to Password Protect a Form or Report in Access

by Shane Zentz
Microsoft makes doing a lot of things with databases very easy. And password protecting a form or report is no exception. With just a few lines of code in the right place you can prevent unwanted users from opening and viewing or editing data in your form or report. Just as an aside, this is not the most secure method and in fact is not really secure at all. But in order for someone to find the password (which is hard-coded into the application) they would have to have at least basic knowledge of access from the design and programming point of view, so if they are just users then chances are that they will never discover the password (by looking at the code behind the program) unless someone tells it to them or they discover it written down somewhere. Having said that, this method is still pretty useful for just average applications, like I said it is not really the most secure method, so if your application contains really sensitive data (like social security numbers or bank account numbers) then I would advise using another more secure method. But if you just need a basic password protection to protect just one or a few forms from average users then this method will work and it is also quick and very easy. So read on to see how this is done.

Open the form or report that you want to password protect in design view and find ‘form’ in the properties field (see photo 1). Then switch to the events tab. Under the events tab you will see a field called ‘on load’ (see photo 1), this is the field that controls what the form or report does when it is first loaded or opened. Here we want to add some code to the on load event so that it will first prompt the user for a password. So click on the tiny icon with the three little dots on it and on the window that pops up, select ‘code builder’. This will bring up a Visual Basic window (see photo 2) which will have a method for the ‘onload’ event preloaded. All we need to do is to add the code to this section.

 

Here is the code:
Dim PassWord As String

PassWord = InputBox(“Enter Password”)

If PassWord = “whatever password you choose here” Then’

Open FormDoCmd.OpenForm “name of the form that you want to password protect”
ElseMsgBox (“Wrong Password?”)

DoCmd.Close acForm, Me.NameEnd If

Save the code and exit and also save the changes to the form. Now try to open the form and you will get a password box before the form will open. If you enter the correct password then it will open, otherwise it will not. Another thing I should mention is that the text for the password is not dotted out or starred out like is usually is with password protection forms. I think that this can be changed but that is beyond the scope of this tutorial.
This code is pretty basic. To use this you will need to change the line that says “whatever password you choose here” to whatever you want the password to be. And then change the “name of the form that you want to password protect” to the name of your form. Now, you can change “Enter Password” to whatever message you want to appear when the password box comes up, and likewise, you can change the “Wrong Password?” part to whatever message that you want to display when the user enters the wrong password or does not enter any password at all.
So there you have it, a pretty easy and basic password protection system to password protect a form or report in Microsoft access. This will work with just about any version of Access, so give it a try. Just remember that this is not really completely secure becuase anyone who knows how can just look at the form in design view and then check the ‘onload’ event code to discover the hard-coded password, but the average user will never know how to do this anyway, so this is a reasonably decent solution.
Thanks for reading this tutorial on password protecting a form or report in a microsoft access database.

How to Create a Basic 'TEST' Database in Access

Create a basic test database in access 2010:
This tutorial covers how to create a ‘test’ database in Access 2010. You might say, why create a test database? Well, the answer is that sometimes it is much easier to start with a simple database with only a few tables and forms to see how your project will work when it is scaled to a much larger level. The main reason is simplicity and testing. Testing and coding is always much easier when working on a smaller scale. If you are familiar with programming then you know that it is easier to code one small module (or function, or method) at a time instead of trying to write the whole program line by line. It is the same principle here. So if you have a project to do in access, whether large or small, hard or easy, for work or school, then this tutorial will show you how to quickly set up a test database in Access 2010.

Let’s say, just for an example, that your project involves a large amount of data and data sets, but you are currently stuck on a certain relationship between two tables or a design problem between two tables or a programming issue between two tables. Then instead of working with a large set of data and tables (and queries, relationships, modules, ect.) it may be easier to just create two example tables that are at least similar to the ones that you are currently stuck on, and then add a little bit of test data just to work with. This should be easier than working within your complex project and then when you have the problem solved or have a worked out solution, it will be much easier to just import that solution into your project.
So for this lets assume that you are stuck on some problem that exists between one table which contains customer data and another table which contains data for a business. In this scenario, I would create a simple access test database with only two tables. The tables will be called ‘customer’ and ‘business’ to keep it pretty simple. And the tables will have the expected data fields to go with them as well. So the first step is to open access and create the two tables:

And add all the necessary fields, but remember that this is just a test so there is no need to add each and every field, we just want some example data to work with and we still want to keep it pretty simple to make it easier to work with.

Then, once you have the two tables and the data fields that correspond to those tables, now it is time to add some ‘test’ data. Just make up a few customers and a few businesses, in this case. Now we have our test database set up and we are ready to solve our problem.
Is it a relationship problem?

Is it a design problem?

Is it a module/coding problem?

As you can see it is sometimes easier and beneficial to just create a simple test database to solve a problem that would be more difficult to solve on a larger scale, then import the solution into the more complex project. So I hope that this advice will help with your next access database project or assignment.

Thanks for reading this post!

Shane Zentz

How to auto fill fields in access (2010) based on combo box selection

How to auto fill fields in access (2010) based on combo box selection

by Shane Zentz

Access is a great program for small level databases. The kind of databases and programs that almost every small business today needs. And of course Microsoft makes it very easy for almost anyone to create a complete database driven solution. Simple order entry database programs are very common in todays business, and Microsoft Access makes it possible to create a viable solution reasonably quickly, efficiently, and economically. Access contains a number of features that make it the database application of choice for small businesses today. One of those features is the combo box. This tool allows the end-user to simply select an item from a drop down menu, instead of having to type it in manually. A real time saver. But from the programming and database designer point of view, they can sometimes be a little difficult and frustrating to work with. So this article is about what I have learned in working with these combo boxes, and how to succeed in your next Access project by using these handy tools.

For this article I will start with a simple and very basic table that looks like the following:
ID (autonumber primary key), Customer (text), Address (text), City (text), State (text), Zip Code (text). This is obviously a simple customer database which will hold typical customer data. The kind of data that a lot of small businesses would have and would need to store in an efficient and easy way. I am not going to go over how to create the tables in access as that is a little below the level of this article. But check out google for many articles on how to create basic tables and basic databases in any version of Access. So we assume that we have our customer table in place. And we can also assume that we have some arbitrary amount of (valid) data inserted into the table.

This data will be useful for many purposes to most small businesses. However in an effort to increase efficiency and also accuracy, it would be nice for the end-user of this database to be able to just search for the customers name and then all of the data related to that particular customer would then be displayed in the correct fields. This is possible with access and combo boxes. In fact there are at least two ways of doing this. The harder way and the easier way. The harder way involves adding some simple code to the combo boxes ‘after update’ property. Usually something like TextBox151=ComboBox9.Column(2). This method certainly works, but there is an even easier (and cleaner) method of accomplishing this with no code at all. So now we know what we want, we want to auto fill fields of a form or report based on the value chosen by the end user in a combo box. Read on to learn the easy way to achieve this.

Recall that we have our simple ‘Customer’ table and that it is filled with some kind of data (even test data is fine). So what we want is a form that will display that data. This is very easy in Access, but we want more. We want a combo box that will only display the customers name, and when the end user selects a certain customers name the rest of the data for that customer (address, city, state, etc.) will automatically fill the fields of the form. So here is the easy way to do this. The tricky way. First open the customer table (in this case, your table will probably be named differently) in datasheet view. With this table open, go to the ‘Create’ tab. Now on the ‘Create’ tab, you have three choices for creating a form (or possibly even more). But the first choice simply says ‘form’. This is the one that we want.

So select this choice and you will see Access will create a neat looking form that has every field of the table (Customer, in this case) that was used to create it. Now you can close out the customer table. Go to the form that Access created when you clicked on the ‘form’ button. Switch to design view. Try to make some room somewhere on the form to add the combo box. Then select the combo box tool on the ‘Design’ tab and place the combo box somewhere on this form.

 

A wizard will open. If you have added combo boxes in other places you will notice that if you use this method of adding a combo box, now you have a third option of where to get the data for the combo box from. And this new option (the bottom one) which says something like “Find a record on my form based on the value I selected from combo box”, is exactly the one that we want.

So select that and choose something logical to fill the combo box, in this case I would choose Customer (the name of the customer, to make it easy for the end user to find who they are looking for). Now save the form and switch back to form view. Test it out. You should see that when you select a customers name, then their corresponding data is automatically filled in to the other fields of the form. Like magic.

If this has not worked for you, then you have probably missed a step listed above. The most important things are to make sure that Access makes a form for you based on the table that you want to pull the data from, and that you choose the third option in the combo box wizard (the one that says something like “Find a record on my form based on the value I selected from combo box”. If these steps are followed then your form should be autofillingout itself based on the end users choice in the combo box. Now what you do with this data and this form are up to you. And remember that this is only one method of accomplishing this little bit of magic. If this does not work for you or does not suit your needs, then I would recomend trying the method which involves adding a bit of code to the ‘after update’ event on the combo box. A little more difficult, but still pretty easy. Anyway thanks for reading this Access tutorial and article.

Shane Zentz