Welcome to my Access Blog
Access Developer Tools
FMS Developer Tools are arguably the most comprehensive set of tools for Access, SQL Server, and .NET developers.
Access Sites and Pages
My Blog List
-
Singing (and Dancing) With Access6 years ago
-
-
-
Over Worked?9 years ago
-
Stay connected wherever work takes you10 years ago
-
-
-
-
-
Access Support Sites
Blog Archive
About Me
... GPG On MS Access: Back to Earth for a Moment.
Office 2010 Set to Launch
The Microsoft Office 2010 Engineering Blog has announced a May 12, 2010 worldwide launch date for “the 2010 set of products, including Office 2010, SharePoint 2010, Visio 2010, and Project 2010” for business users. Office 2010 will be available for consumers on-line and in retail outlets in June 2010. If you want to have an sneak preview look at what is coming you can download the beta at www.office.com/beta.
I have been poking around the Access 2010 beta for the last while and I think it is going to be a nice version to work with. In case you are wondering, the Ribbon stays. In fact, I believe that the Fluent User Interface as the Ribbon is officially, will now be found throughout the Office suite. The Office Button has been replaced with a File tab on the ribbon. This tab leads to the backstage of each application.
Quote of the Day
Perhaps the most valuable result of all education is the ability to make yourself do the thing you have to do, when it ought to be done, whether you like it or not; it is the first lesson that ought to be learned; and however early a man's training begins, it is probably the last lesson that he learns thoroughly.
- Thomas H. Huxley
The single-most exciting new development as far as Access is concerned is that it is now possible to develop Access Web Databases and publish them to SharePoint. Ryan McMinn present this new development in this video.
If you are interested in general Office development, have a look at John Durant's presentation.
Pej Javaheri and Steve Tullis present Excel and Excel Services 2010 developments in this video.
All in all , Office 2010 looks pretty exciting with lots of new ‘stuff’ to learn but with big paybacks for taking the time you will spend on learning.
Access Naming Oddity
As a design principle, I apply a naming convention when creating new database objects. For example, field names begin with a lowercase letter. Recently, I was putting together a small application in Access 2010 beta so that I could gain a little familiarity with the new Access version that will be released later this year. In a weak moment, I accidentally named some of the fields in a new table with uppercase first letters.
In the grand scheme of things, this is not a particularly serious problem but inconsistently formed names lend an unprofessional look to an application. When I tried to correct the names I discovered an inconvenient quirk. After replacing the first letter of each field name with its lowercase equivalent, saving and closing the table and then re-opening it again in design view, I found that the first letter of each field name had changed back to uppercase.
No matter what I tried, I couldn’t get the lower-case letter to ‘stick.’ That’s when I turned to my favourite forum for help. Thanks to UtterAccess VIP member (and Access MVP) datAdrenaline, I quickly had a reasonably workable solution.
Quote of the Day
I have never been especially impressed by the heroics of people who are convinced they are about to change the world. I am more awed by those who struggle to make one small difference after another.
- Ellen Goodman
All I had to do is change the first letter of each field name I wanted to modify, save and close the table, re-open the table and replace whatever I had entered as the first letter of the temporary field name back to the lowercase letter with which I wanted to start the name. Step by step this is the method I applied:
- open the table in design view
- pre-fix each field name with a single letter
- delete and replace the original uppercased letter
- save and close the table
- reopen the table in design view
- remove the leading character for each field to correct name
- save and close the table
This problem occurred specifically in Access 2010 beta so it may be a non-issue when the new version is released but if you run into similar situations perhaps a similar approach will help you out of a bind “when all else fails.”
New articles in Access Wiki
Access Wiki – 2 Weeks and Counting
Quote of the Day
Real, constructive mental power lies in the creative thought that shapes your destiny, and your hour-by-hour mental conduct produces power for change in your life. Develop a train of thought on which to ride. The nobility of your life as well as your happiness depends upon the direction in which that train of thought is going.
-Laurence J. Peter
By the end of the day, the Access Wiki will have been ‘open for business’ for two weeks. The body of Access knowledge that the site promises to be is slowly building. As of this moment, there are 26 articles published in the wiki with articles including such topics as Normalization, Sharing (Access Databases through splitting), and Error Handling. Access Wiki content is expected to grow as UtterAccess members continue to write and publish articles. The wiki features a table of contents and an index if you want to look over a list of topics.
Meanwhile, on the forums side of UtterAccess, there is a whole new ‘look and feel.’ The new appearance is similar to what you will see one the Wiki side.
If you haven’t yet visited UtterAccess.com Forums or the Access Wiki, why not check them out now and see if you don’t agree that UtterAccess is the only source for all of your Microsoft help needs. The wiki and forums are freely available to anyone on the World Wide Web but only registered members can download code samples from the forums or write and edit wiki articles. Membership is free and confidential. Signing up will give you access to thousands of downloads and the opportunity to contribute your own articles to the Access Wiki
UtterAccess Launches Access Wiki
Quote of the Day
The most important thing in the Olympic Games is not winning but taking part; the essential thing in life is not conquering but fighting well.-Pierre de Coubertin |
The best forum in the Access community, UtterAccess, is about to get even better. Tomorrow, The Access Wiki will take its place alongside UtterAccess Discussion forums. This is the most significant enhancement to UtterAccess since its inception some eight years ago. In the coming months and years, the wiki is expected be become a treasure house of in-depth information for Access database developers as members contribute and update original articles discussing all aspects of developing and enhancing Access applications.
Sometime overnight tonight, UtterAccess.com will go off-line and will be unavailable for a brief period. Then, with little more fanfare than the flipping of a switch, the wiki will be ‘live to air’ and the forums will be back on-line. If you have ever visited the UtterAccess site, you will immediately notice the forum’s new look and feel, even a brand new logo, thanks to UtterAccess member and moderator Mark Davis. The wiki will share the new ‘look and feel’ of the forum. UtterAccess members will be able to log in to the wiki using the same user id and password as they use for the discussion forums.
What is a wiki? A wiki (pronounced /ˈwɪki/ WIK-ee) is a website that allows the easy creation and editing of any number of interlinked web pages via a web browser using a simplified markup language or a WYSIWYG text editor. Wikis are typically powered by wiki software and are often used to create collaborative websites, to power community websites, for personal note taking, in corporate intranets, and in knowledge management systems. (Wikipedia, the free encyclopedia)
The UtterAccess Access Wiki and Discussion Forums will naturally complement each other. Discussion Forums provides a question and answer peer support environment where members can raise and respond to specific problem oriented questions. The wiki will provide in depth discussions of Access related topics to which a user may point when responding to questions. Access Wiki readers will turn to the Discussion Forums from time to time when they need help in understanding topics discussed in the wiki. Together Access Wiki and Discussion Forums will be a win-win partnership in Access education, re-affirming that UtterAccess.com is the only source for all of your Microsoft Access help needs...and more!
I’d like to thank UtterAccess.com Owner/Administrator Gordon Hubbell for keeping UtterAccess in the forefront of the Access community over the years and for his tireless efforts along with help from Microsoft’s Clint Covington and Kerry Westphal over the past couple of months to bring the Access Wiki to fruition.
As soon as the relevant links are available, I will be publishing a follow up article.
Congratulations Gord and UtterAccess!!
Let’s Split
The term ‘split database’ seems to strike fear and trepidation into the hearts of people just getting to learn about creating Access applications. This article is for Soma, who raised the question privately with me. Thanks for asking Soma, I hope these few notes help you to a better understanding of what a split database is and why you should split it.
What does ‘split database’ mean?
An Access file (.mdb 2003 and earlier, .accdb – 2007 & 2010) can contain both user interface and the data of the database. Think of the user interface as being everything you need to display data to the user in useful and meaningful ways, everything, in fact, except the actual tables and relationships between them.
A split database architecture separates the user interface from the data. In Access, the user interface ‘lives’ in a file known as the frontend. This file contains all of the application’s forms, reports, and queries. The backend, on the other hand, is a second file that contains the tables and relationships of the database.
Why should a database be split?
Separating the user interface and data storage functions into two separate files makes the database easier to manage and greatly simplifies the enhancement and deployment of frontend modifications.
In a multiuser environment, a split database is mandatory so that all users can share and work with the same data. That is because their individual copies of the frontend all link to the same backend. To put it in somewhat techy terms, one data source serves all users of the database. If each user had his or her own copy of the data, managing changes to the data and keeping all copies of the data ‘in sync’ adds a whole new layer of complexity to managing the data.
However, even if there is only one user, a split database still makes a lot of sense. That is because you can continue to develop and enhance (and replace) the frontend as needed without jeopardized your valuable data. In my own applications, for example, I have a frontend that I use on a day to day basis. I have a second, development, version of the front end where I try out new ideas for form and report design. The development frontend is linked, not to my live data, but to a test dataset that I copy from my live data from time to time. When I am satisfied that the development frontend is working correctly and has been properly tested, I put it ‘into production’ by linking it to my real frontend. (Incidentally, UtterAccess moderator Cybercow has posted a nice utility for switching a frontend’s between test and live data in the UtterAccess Code Archive
How do you split a database?
Generally, splitting a newly developed Access database is quite straightforward. Access includes a Split Database wizard that will move the original database’s tables and relationships to a new file. There is also the Linked Table Manager to allow you to manually link a frontend to the backend when necessary.
This article is intended to be a brief overview of what it means to have a split database. The Access help files contain more complete descriptions of the concept and how to go about splitting your database. You might also what to do an advances search for ‘split database’ at UtterAccess where you will find many questions on the topic posted by many new members over the years.
Keep an eye on UtterAccess.com
Gord over at UtterAccess is putting the finishing touches on an enhancement to the UtterAccess forum that will be as significant for the Access community as was the introduction to the web of UtterAccess itself almost eight years ago. I’m afraid you will have to wait for the public launch to learn more details but I can guarantee that you won’t be disappointed. At UtterAccess, we pride ourselves as the only source for all of your Microsoft Access help needs. If every you had any doubt about that claim, this new feature will convince you that UtterAccess is what we clam and much, much more.
Access 2010 Forward Compatibility
Quote of the DayIf you have built castles in the air, your work need not be lost; that is where they should be. Now put the foundations under them. -Henry David Thoreau |
Clint Covington posted Access 2010 deprecated features and components in the Access Product Team Blog yesterday that certain features have been deprecated in Access 2010:
- Calendar Control
- Snapshot Format
- Data Access Pages
- Paradox, Lotus, and Red2 ISAM’s
- Replication conflict viewer
If you have applications developed in older Access versions that you want to port to Access 2010, read Clint's article to see what effect these changes will have on your application and some suggested workarounds.You should also keep these deprecations in mind for any new applications you may develop in pre-2010 Access versions.
Date Stamp Access Records
Quote of the DayNot only is the universe stranger than we imagine, it is stranger than we can imagine. -Sir Arthur Eddington | ||
Using forms to control routine data entry should be standard operating procedure for any non-trivial production Access database. In plain language, don’t give users (even yourself when you acting as a user and not the developer) access to the raw tables. Provide instead forms for entering, viewing, and editing records. In this article we will look at how to use two simple form event handlers to automate recording of when a record is created and when each record was most recently updated.
Event handlers are the key to adding custom functionality to applications. In this case, we want to keep track of when a record is created and that date it was last edited so we will need to work with the Before Insert and Before Update events. First, a little background.
When you create and edit a new record, the record does not exist in a table until you do something to cause the record to be saved. You are actually editing a memory image of what will become the new record when it is saved. Actions like moving to a different record, or pressing Shift-Enter initiate the save (or insert) process. As its name implies, the Before Insert fires before the record is inserted into the table.
To be completely accurate, the Before Insert event fires when the user types the first character of a new record (see msdn article). At this point the record does not yet exist. This give you, the developer, the opportunity to take some additional actions by adding appropriate code to the Before Insert event handler. When the Before Insert handler finishes, the saving process continues. Along the way, the Before Update event fires, offering another opportunity to do something in addition to simply saving the record.
The chain of events is quite similar for existing records which are being edited. The only real difference is that the Before Insert event doesn’t fire because we are updating an existing record. The record is already in the table so the memory image of the record doesn’t have to be inserted into the table; the table just has to be updated to reflect the changes you have made to the record’s data. So when you do something to put the save process in effect, the Before Update event will fire before that table data is actually modified.
If you want only a date stamp (without time) the function Date() would do the trick. However if you want the date and time of additions and modifications to be recorded, the Now() function will return a serial date value which it has read from the system clock. The two event handlers are so simple as to appear almost trivial:
Private Sub Form_BeforeInsert(Cancel As Integer)
Me.DateCreated = Now
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.DateModified = Now
End Sub
That’s all it takes. With these two form events in place, every time a new record is created using the form, the record’s DateCreated value will be set to the date and time the user started typing data. Similarly, when the form is used to edit data the, the record’s DateModified value will be set to the time that the changes are saved. An interesting side effect of using this approach is that new records have values assigned to both fields. The difference between the DateCreated and DateModified values indicates how long it has take the user to enter data into the new record.
Keep in mind that, while this approach might appear to be the basis of an audit trail solution, it only keeps track of record creation and last modification date and time. If you want to maintain modification history data you should use a separate, related table with a new record appended to it for each record creation/modification/deletion action.
Download the sample database from here. This is a zip compressed file contained the example in both Access 2000 and 2007 format.
Introduction to VBA Debugging
Microsoft MVP Walter Niesz has put together a nice FAQ (Frequently Asked Question) article over at UtterAccess.com to introduce new Access programmers to de-bugging VBA Code. The article illustrates three basic debugging techniques that should be in every VBA programmer’s toolkit. If you are new to VBA or Access have a look at Debugging Techniques. While you are at UtterAccess.com have a look around at the thousands of opportunities to learn from other’s questions and to find answers to your own questions. (disclaimer: as a forum administrator at UtterAccess I enthusiastically support the forum which is, “without doubt is the only source for all of your Microsoft Access help needs...and more! ")
Access 2010 Navigation
Check out this Access Team Blog article in which Wouter Steenbergen describes new navigation features in Access 2010 in detail
John R. Durant's WebLog : Why VBA Still Makes Sense
This article, John R. Durant's WebLog : Why VBA Still Makes Sense , presents a solid case for why VBA is the ‘next level’ when it comes to application development in Access and other members of the Office suite. John provides an excellent of VBA since its early days to the present and on into Office 2010 including his perspective on the ‘fit’ between .NET and VBA. John R. Durant's WebLog : Why VBA Still Makes Sense is definitely a worthwhile read.
Breaking News – Major Step Forward in Access 2010
Ryan McMinn and Clint Covington demonstrate the most significant new Access feature being introduced in the 2010 version View the latest Office Team Blog article and click the link to their video.
We Are Moving
to www.officetipsandmethods.com
A little over a year ago I started two blogs, Argee's Office Help Blog and Argee's Access Blog. As the titles suggest, the first focuses on entire Microsoft Office applications except for Microsoft Access. The second is aimed strictly at Microsoft Access related topics. I found a number of free blog hosts and started my first OfficeHelp, a Windows Live Site. After publishing a few articles there, I wanted to be able to separate Access oriented articles from those related to the rest of the Office suite. Windows Live blogs are great for personal/social blogs but I couldn’t find a way to classify or categorize articles with more that a single category/tag for each article.
Visiting a few blogs by my Access colleagues led me to consider the Blogger site which is hosted by Google. I decided to locate my Access site there. Each article can have multiple tags. That makes it easier to specifically classify articles so that a reader can find specific topics more quickly.
Recently, I have come to realize that I really wanted an even more sophisticated classification system than what is possible on the Blogger site. Part of this need stems from the significant change that Microsoft introduced into user interfaces with Office 2010. These changes were particularly significant in Access, my main area of interest. A little Internet searching led me to the WordPress publishing platform.
Will WordPress solve my classification problem? It certainly seems so, and then some. I found that I can set up custom categories and sub-categories. That means that I can flag an article as relating to Access generally, to Access 2007, specifically, and that the article is part of a tutorial. I can also tag each article with one or more tags that will aid in subject oriented searching. Best of all, I found I can include a category search capability in a side bar that is always there at the top of the blog page.
WordPress may not be the last word in meeting my blogging needs but so far I like the look and feel. Now it’s time to get back to writing. For the time being I will mirror articles that I publish at OfficeTipsAndMethods on my OfficeHelp and Access blogs so if you have subscribed to one or both of those feeds you will still be notified of new articles in those blogs. But if you want a “one feed serves all” feed, visit
and subscribe to the rss feed there.
Coding Standards Survey – The Importance of Comments in VBA Code
At the end of August, a discussion at my home away from home, UtterAccess.com piqued my interest in the topic of how experienced Access developers viewed the importance of commenting their VBA Code. I decided to conduct a brief survey of two groups, Microsoft MVPs, and UtterAccess VIPs. I specifically notified Access and Excel MVPs as well as the VIP group at UtterAccess.
While there weren’t quite as many opinions as their were people completing the survey, there certainly is a broad range of opinions.
Dennis, an UtterAccess member who was unable to complete the survey because he was away while it was open for response posted a forum message that pretty well sums up my own position on the question. He said in part,
“Commenting code was described by one of my college instructors as one of the most important, but least prioritized steps of the programming process. And I believe he was (and is) 100% correct.
One should never assume that the purpose of a block of code is self-evident. Even if you've used the same module over and over, that module should be documented so that someone (even you) in the future will quickly be able to see HOW and WHY a block of code is doing what it does.
Commenting costs nothing to compiled code, and is worth it's weight in gold to people charged with improving and re-using code. After all, the cliché says "time is money" and the amount of time saved with a few lines of text within a block of code can be enormous.
There, that's about it, in a nutshell.”
I should mention that I did not submit a response to the survey myself; I wanted to leave the answers to others and let the results fall where they may. The results were not particularly startling. They do reflect a broad range of opinion among the respondents. More than half of the 57 people answering the survey rated commenting as being either very important or absolutely essential.
The numerical results, however, only tell part of the story. The survey included two open-ended questions, ‘Briefly describe how you use commenting in your own work and the depth of detail you include in your comments.’ and ‘What would you describe as the single most important reason for including comments in programming code?’
A common theme for the first set of open-ended responses was, “to help me remember what I did and why.” Some of these comments expanded the theme to include “others who might have to follow-up on my work.”
In response to the second open-ended question, one person put it this way, “1stly To remind me of what I wrote and how the code works...I sometimes don't view project for long periods of time. 2ndly so that if or when I expire someone else can take up where I left off.”
There were a few problems with the survey, some caused by my oversight when I designed it and some caused by the the survey software itself. Two people reported either being unable to submit their responses on the the survey site or being unable to edit/include comments that were greater than 255 character. I won’t complain too loudly about the survey site, however, since I used the free survey tool that is available if you register on the site.
As to survey design issues, I neglected to include a ‘none’ category in the question about programming languages other than VBA. That cause the ‘other’ response to be somewhat ambiguous.
All in all, however, I’d have to say that devising and implementing the survey and analyzing the results has been an interesting exercise. I have a few other ideas that I may try in the future. The full survey report is available in pdf format here.
I would like to publicly thank the UtterAccess VIPs and my fellow MVPs who took the time to respond to the survey.
Don’t be fooled!!
I was quite surprised yesterday to see reference to an article I wrote several years ago, Data Modeling for the Access Newcomer is an internet newsletter. I am not going to name the newsletter here because I don’t want to give it any free publicity. You won’t find it by links that I provide.
The particular newsletter follows the questionable practice of posting teasers about articles with links that lead to a sign-up page for their paid service. Once you have signed up, chances are all you will find is yet another link, this time to another site where the piece was available to you free of charge all the time. So you have just paid for, or at least signed up for a trial of, a service that frequently simply provides you links to pages and sites that a freely available without ever going near their service. If it was a free trial, you can bet they will then be soliciting you for a paid subscription. Definitely don’t buy the subscription unless you feel you are getting real value for your money.
In the case of my article, the full text of the article is freely available in Garry Robinson’s excellent VB123 blog. Garry recently purchased rights to the best years of Smart Access magazine (the years when Peter Vogel was the editor.) You can purchase electronic versions of sets of the magazine from Garry’s vb123 site if you are interested in a set of excellent articles that spanned the years from October 1996 to April 2006. That is almost 10 years of monthly issues with articles by hundreds of Access experts.
If you are just interested in my article, this link Data Modeling for the Access Newcomer, will take you to the full text of the article. Garry is very generously publishing the full text of individual Smart Access articles in his blog. He has a convenient index to the Smart Access articles.
There is an old expression that says, “Why buy the cow, when you can get the milk free?” While the expression can have a somewhat off-colour meaning, depending on its context, I think it deserves a paraphrase here, “Why pay for a link when you can get to the real article free?” If someone is trying to sell you links, use your favourite search engine to find your own links. It won’t cost you a cent.
Creating Tables
In the last installment we explored the many to many relationships that exist between our various table. At that point we had not yet created the tables. This article will deal with the nuts and bolts of actually creating a table.
A word about names
The names you use when you create your database objects are important and should follow certain guidelines. Access reserves certain words for its own use. Logically these words are known as reserved words. Unfortunately some of these words are the first that comes to mind when you are trying to name fields for example. In this article I discussed at a conceptual lever, the tables we need in the Ice Cream Parlour database. If you look back to that article you will see names like ‘Name”, “Description”, and “Type”. These words all have special meaning within Access and should not be used to name Access objects.
So you will notice that the field names in the relationship diagrams in my last article are different from those I used in the conceptual diagrams. So, for example I have a field ‘strSundaeName’ rather than simply ‘Name’. What about the ‘str.’ That part of the name comes from a convention I follow to add a prefix to the name that indicates the datatype of the field. Many Access developers do not use prefixes for field names. So SundaeName would be perfectly acceptable and, in fact, preferred by many developers.
On the other hand, many developers do follow a naming convention that prefixes the names of Access objects like tables, queries, forms and reports, with three characters to signify the type of object to which the name pertains. So, for example, the Sundaes table is actually called ‘tblSundaes’.
Notice also that tables are usually plural. That is because the table contains records where each record is one example (or instance) of the subject of the table. So, tblSundaes has fields with names like strSundaeName (or SundaeName, if you prefer.)
Creating a table
There are several ways to create a table in Access. Although I don’t recommend it, you can design a table by entering data into a datasheet. Access will determine the data type for each field based on the data you enter. And unless you are careful to name each field, Access will assign such helpful field names as Field1, Field2, etc.
In Access versions prior to 2007 there are table creation wizards and in 2007 there are table templates to help you out. Unfortunately, tables created by wizards or from Access 2007 templates have field names that do not follow accepted naming standards. They include spaces in the field names. Now, while this may seem perfectly natural to you if you are an Access beginner, those spaces will come back to haunt you when you decide to enhance your work using advanced features like Visual Basic for Applications (VBA).
I prefer to create all tables using the Table Design View. Before we go there, however, we should map out the fields we will need and determine what their respective data types should be. For the sake of illustration I am going to deal with creating one of the tables we have decided we need. If you are following along and creating your own ice cream parlour database, the best way for you to learn will be for you to create the other tables on your own. I will be providing a link to my version of the database with all tables created.
Before we look at the table designer, let’s summarize the information we will need for each table. I am indicating two possible names for each field. The first name follows the naming convention I prefer to use. The second is a valid name in a format that omits the data type prefix. Whichever style you choose, it is important to be consistent throughout the database.
Sundaes - tblSundaes
attribute | field name | alternate name | data type | data size | notes |
| Primary Key | idsSundae | SundaeID | Autonumber | long integer | |
| Name | strSundaeName | SundaeName | Text | 25 |
Dishes - tblDishes
attribute | field name | alternate name | data type | data size | notes |
| Primary Key | idsDish | DishID | Autonumber | long integer | |
| Name | strDishName | DishName | Text | 25 | |
| Type | lngDishType | DishType | Number | long integer | foreign key – used to find the dish type description in the types lookup table |
Sizes - tblSizes
attribute | field name | alternate name | data type | data size | notes |
| Primary Key | idsSize | SizeID | Autonumber | long integer | |
| Name | strSizeName | SizeName | Text | 25 | |
| Type | lngSizeType | SizeType | Number | long integer | foreign key – used to find the dish type description in the types lookup table |
Flavors - tblFlavors
attribute | field name | alternate name | data type | data size | notes |
| Primary Key | idsFlavor | FlavorID | Autonumber | long integer | |
| Name | strFlavorName | FlavorName | Text | 25 |
Ingredients - tblIngredients
attribute | field name | alternate name | data type | data size | notes |
| Primary Key | idsIngredient | IngredientID | Autonumber | long integer | |
| Name | strIngredientName | IngredientName | Text | 25 | |
| Type | lngIngredientType | IngredientType | Number | long integer | foreign key – used to find the dish type description in the types lookup table |
Those are the basic definitions of our five central table. As already noted, we will need additional tables in the database to allow us to connect these central tables together so that the database reflects the one to many relationships between them. We will also need a lookup table for types the type descriptions used by tblDishes, tblSizes, and tblIngredients.
Coming next: Using the table designer.
Access 2010 Preview
While an actual release date is still to be announced, the next version of Office and Access are looking pretty exciting. For an overview of what’s coming in Access, have a look a the Access team blog.
Connecting the dots – well the main tables, anyway
Thanks to grovelli who prodded my about the next installment in the Ice Cream Parlour tutorial, here it is.
When we last looked at the ice cream parlour database, we had identified the main tables of the database:
- sundaes
- dishes
- sizes
- flavors
- ingredients
For now, let’s focus on how to connect these tables together rather than on the contents of each field. You may recall that we identified the relationships between most of the pairs of tables turned out to be many to many. That is, for example, one sundae may use many ingredients and each ingredient can be used in more than one sundae.
To keep it simple I am going to focus on just this one pair of tables, sundaes and ingredients. Let’s say, for the sake of argument, that we have come up with a recipe for what we are going to call Chocoholic’s Mega Gooey Sundae Delight. Because we have chosen to use autonumber primary keys when we enter this recipe title in the Sundaes table access assigns 621 as the primary key. Now, if we need to refer to our Mega Gooey Sundae Delight outside of the table all we (or Access) need to know is that this particular Sunday is number 621 in our table.
Actually the end user does not need to know the value of the primary key at all. There are ways of getting the value and causing it to be entered in other tables without actually having to actually know the number.
So far, so good. Now the Mega Gooey Sundae Delight recipe calls for these ingredients
- Chocolate Ice Cream (832)
- Chocolate Sauce (365)
- Chocolate Sprinkles (798)
- Marshmallow Sauce (922)
- Toasted Almond Slivers (305)
After each ingredient name, I have shown for the sake of this illustration, the primary key that Access assigned to each of these ingredients when they were added to the ingredients table. The actual number doesn’t matter. What is important is that no two ingredients share the same number. To put it in Access’s terms, the values are unique. That means that we can be confident that whenever we refer it item 922 in the ingredients table, we are talking about Marshmallow Sauce.
Here is the relationship diagram for these two tables:
The junction table I have been describing is tblSundaeIngredients. The infinity symbol indicates that that side of the relationship is ‘many’, meaning that each sundae in the tblSundaes can have many corresponding records in the junction table. Similarly, each ingredient can have many corresponding records in the junction table as well.
I will go through the process of actually creating the tables and relationships in later installments of this series of articles. For now, I just want to focus on what things look like when we bring together a sundae with its ingredients using a junction table.
To keep things simple, I have included in the diagram only the fields and records necessary to illustrate the point. Notice how the junction table includes only numbers and those numbers are the same as the primary keys of each of the ingredients in tblIngredients. This is typical of tables that are related. The fields lngIngredient and lngSundae are known as foreign keys. In other words the values in those fields tell us what values we are talking about in the other (or primary) table.
Next time, we will take a look at actually creating these Access tables. Following that, we will look at the process for creating relationships.
Great News - I have been recognized as an MVP for another year
Yesterday, July 1, I received the notification that I have been recognized as a Microsoft Most Valuable Professional for the third year in a row. This is indeed a great honour, considering that there are fewer than 5,000 MVPs world-wide. One of the benefits of being an MVP is that we have a designated person (our MVP lead) at Microsoft) with whom we can correspond on a personal basis. You can read more about the MVP program on the MVP website.
