Awards
Join OfficeTipsAndMethods

Have some suggestions to share with the world?

Join OfficeTipsAndMethods and share your insight in a Comment. You must be a member to comment and all comments are moderated before being published. Membership is free and we would never share your personal information with anyone.

Become an OTM Member

Log In

YouTube Video Channel
OfficeFix
Article Categories

Archive for the ‘Access’ Category

Access Runtime (2013 Version)

Microsoft’s free Runtime for Access 2013 is now available for download from http://www.microsoft.com/en-us/download/details.aspx?id=39358.

The Runtime allows you to run Access applications without having to purchase and install Access.

Professional Access 2013 Programming–Just Released

imageWritten by a team of MVPs most of whom are also members of UtterAccess.com, Wiley have just released what promises to be an essential and major resource for Access developers.

Judging by many on-line discussions that I have read in the past few months, Access 2013 includes significant enhancements, especially related to Cloud based applications.

Congratulations are definitely in order for the core authoring team, Teresa Hennig, Ben Clothier, George Hepworth, Doug Yudovich, and to the technical editors and contributors, Glen Kruger, Jack Leach, Jerry Dennison, Leo (theDBguy™), Patrick Wood, Peter Doering , Tom van Stiphout, Scott Barker.

Enhancements and Issues Office/Access 2010 SP2

Luke Chung of FMS Inc. has published this paper which should be of interest to anyone working with Access 2010 and Office 2010 generally

Access–The Right Tool for the Job

Guest Blogger Jack Leach is a colleague of mine at UtterAccess where his pet project is the Access Wiki. Recently, in a mailing list that we both subscribe to, Jack posted his experience in building an Access application for his business. You can find his website at http://www.dymeng.com and his blog at http://dymeng.com/blog. Jack has graciously given his permission to OTM to publish his success story.

I’ve used Access to create a shop management software for my manufacturing business.  Besides the average FE type stuff: customers, orders, purchasing, quickbooks integration, the software also handles all the backend stuff: visual scheduling, what-if scenarios, integrated quality control, everything right down to tooling tracking (of which there’s thousands).  Min/Max for both customer pull-supply as well as shop supply, so on and so forth.  The whole nine yards.

Even more so, I was able to integrate basic CAM (Computer Aided Machining – like CAD that outputs machine tool code for producing the parts) into the routing structure for the components we make.  AutoCAD automation for reading customer drawings and auto-generating tolerance sets for quality reporting, etc.

The very first piece of the application – my first Access project – saved the company an estimated $20k/year by providing different machine code formats for different machine tool platforms.

We work with medical, military, aerospace and other demanding industries, which has all been fully supported by this for quite a few years.

3D Graphs Fool the Viewer’s Eye

Recently, a colleague distributed some rather important health and well-being statistics, illustrating the data with an exploded 3D Graph. Unfortunately, while 3D graphs are more pleasing to the eye than their flat cousins; the perspective necessary to create the 3D illusion, distorts the values being plotted.

Here’s an example using simple arbitrary data. First the exploded version:

 

Pie 3D

Pie Flat

 

 

 

 

 

Notice how, in the 3D version, the Cons wedge appears smaller than the Pros wedge, even though the two wedges represent exactly the same value (46%). In the flat version, on the other hand, the Pros and Cons wedges appear to have exactly the same size.

Is it the Exploded view that creates this illusion? Consider the following unexploded views. The illusion persists.

 

Pie 3D UnexpPie Flat Unexp

 

 

 

 

 

 

 

An unscrupulous presenter could easily use this illusion to distort the facts and unfairly influence his/her audience. (Remember the adage: “Figures don’t lie; liars figure”?) Think about a political race, for example. Depending on which position the presenter wants to improve the apparent advantage of, all he or she has to do is rotate the 3D chart accordingly to immediately improve the apparent advantage of the favoured position:

Pie 3D Unexp

Pie 3D Cons Ahead

 

 

 

The Pros Have It!

The Cons Have It!

Of course, these examples include data labels to help the viewer’s interpretation. Omitting the labels can only make the dishonest presenter’s self-appointed task of deception easier.

So the next time you have to create a graph, think carefully about purpose of graphs and avoid the inevitable optical illusions inherent in 3D charts.

So You Want to Expand Your Office Knowledge?

Here are some useful links that I have recently come across on the Web. The list is weighted in favour of Excel only because, at the moment, I am doing mostly Excel training.

OFFICE

Migrating from Excel 2003 to Excel 2010

A help guide to working with the Fluent User Interface (Ribbon) first introduced in Office 2007 and enhanced in Office 2010, replacing traditional menus and toolbars

BLOGS AND PEER SUPPORT SITES

Office Tips and Methods

A blog focusing on tips and how to techniques for getting the most out of Microsoft Office Applications

UtterAccess

User peer support forum primarily focused on Microsoft Access but with an active Excel forum as well

Mr. Excel

Bill Jelen’s (Mr. Excel) site includes peer support forum and many pages of Excel help and tips from Mr. Excel himself

Excel is Fun!

YouTube gateway to the ExcelisFun channel –hundreds of well documented videos illustrating how to do just about anything in Excel.

Microsoft Answers

http://office.microsoft.com/en-us/excel-help/use-excel-spin-boxes-to-help-with-financial-modeling-HA001226521.aspx?pid=CL100570551033

EXCEL

http://www.scoop.it/t/excel-hero-linkedin-group/

An excellent collection of Excel related links

http://www.lynda.com/Excel-2007-tutorials/Data-Validation-in-Depth/77849-2.html

Clever data validation example

http://www.andypope.info/charts.htm

Charting Examples

http://dmcritchie.mvps.org/excel/colors.htm

Color Palette and the 56 Excel ColorIndex Colors:

http://www.contextures.com/xlUserForm01.html

Create an Excel UserForm

https://sites.google.com/site/exceladdinsdirectory/

Excel Add-ins Directory:

http://www.excel-blackbelt.com/

Analytics and Visualization

http://social.msdn.microsoft.com/Forums/en-US/exceldev/threads

Excel for Developers

http://excel.tips.net/C0200_Macros.html

ExcelTips:

http://www.excel-spreadsheet.com/vba/vba.htm

Excel VBA – Reference Guide

http://www.exinfm.com/free_spreadsheets.html

Free Spreadsheets

https://groups.google.com/forum/?hl=en&fromgroups#!forum/microsoft.public.excel.programming

microsoft.public.excel.programming:

http://www.gummy-stuff.org/Excel/

Index of /Excel:

http://spreadsheetpage.com/

The Spreadsheet Page:

https://sites.google.com/site/exceladdinsdirectory/home/main-directory

Excel Add-ins Directory

http://answers.microsoft.com/en-us/office/forum/excel

Use Excel spin boxes to help with financial modeling:

http://www.functionx.com/vbaexcel/

VBA for Microsoft Office Excel 2007

http://tech.groups.yahoo.com/group/ms_excel/

Yahoo Groups MS_Excel

http://tech.groups.yahoo.com/group/ExcelVBA/

Yahoo Groups Excel VBA:training.

UtterAccess Featured Wiki Content

Jack Leach who has been very busy for some time tweaking the Access Wiki has just posted this news item at UtterAccess, the first of an announcement series for Wiki content. In this announcement, Jack feature these articles:

  • Base Ten to Base Letter
  • HttpRequest_Class and Access and the web HTML Object Library
  • TypeOf

If you are interested in enhancing your Access knowledge check out Jack’s post for links to these article. You might even want to browse the entire Wiki Table of Contents.

Create a Nested Form Access User Interface

This article demonstrates how to create a co-ordinated set of Access forms that could be used, among other things, as a Dashboard or Launching Pad in an Access User Interface. Form content depends on the needs of the application. The forms in the demonstration application are just simple examples to illustrate what can be done. They are there just to show what the code behind the scenes does.

The concept is similar to Frames in HTML Documents.

The Forms

There are six forms in the demonstration application:

Screen1r

frmShell can be thought of as an outer container or framework. It has one subform control and command buttons and a toggle button that swap actual forms in and out of the subform control. This the opening form for the application. When the application starts, this nested form displays a simple welcome message which is contained in frmShell_ContentWelcome.

frmShell

 

The other forms take turns populating either frmShell’s subform control second level subforms. The form name indicates each form’s relative position in the overall hierarchy.

Screen2r frmShell_ContentA is at the second level of the form hierarchy. If you consider frmShell to be at the top level of the form hierarchy (the patriarch) then frmShellContentA represents a child of the patriarch. frmContentA itself has two children (siblings if you don’t mind the metaphor.)

frmShell_ContentA populated with frmShellContentA

 

ContentA and Subformsr The content forms can be loaded as individual standalone forms.

frmContent and its two child forms

 
Screen3r Screen4r

frmShell_ContentTabs

frmShell_ContentTabs with Mouse pointing at the Child Tab

Screen5r  

frmShell populated with frmShell_ContentTabs (populated with frmShell_ContentA)

 

frmShell_ContentA_1 and frmShell_ContentA_2 populate two subform controls on frmChild when that form is the main child form of frmShell

frmShell_ContentTabs is an alternate child form to frmShell. This form uses a tabbed style of interface to swap its subform content in and out.

frmShell_ContentWelcome populates frmShell with startup information.

Behind the Scenes – the Code

The main code that makes it all work is quite simple as long as you get the notation right. Content screens are swapped by assigning a form to the SourceObject property of the desired subform control.

For example, if a form has a subform control named fsbMainWindow, then a content form (for example, frmContent1) can be assigned to the control with this statement:

me!fsbMainWindow.SourceObject = “frmContent1”

Once the content form has been assigned to the subform control you can then refer to any controls or public properties in one of two ways:

me!fsbMainWindow.Form.[name of property or control]

or by creating a form object and assigning the subform object to the form object. Of course you have to declare a from object.

Dim frm as Form

then you can use the object by assigning the subform control to it.

Set frm = Me!fsbmMainWindow.Form

You can then use the object to refer to the content form and its controls and properties.

frm.txtDate = Now()

assigned the current date and time to a textbox named txtDate on the content form.

If there are several ‘windows’ on the form, then the object approach makes it easier to keep track of which window content you are referring to.

A subform can talk back to the form that contains it using its own parent property.

me.parent.CurrentChild = me.name

is a trivial example. Of course you would have to declare a public variable or property, CurrentChild in the parent form.

It is possible to nest up to seven levels (Access XP and later, three in Access 2000) of subforms on a form. The notation can be confusing because you have to have the bang operator (!) in all the right places. For example,

Me!fsbMainWindow.Form

refers to the subform one level down. If you want to refer to a subform nested on the form one level down, the notation is

Me!fsbMainWindow.Form![name of subform control].Form

For a general reference on referring to sub forms and sub reports see this page on The Access Web.

If you need to set the focus to a control on a sub form, first set focus to the sub form control and then set focus to the control you want to have focus.

General Development Guidelines

If you will be swapping several forms in and out of the same subform control, it helps to first create a simple empty form that is set up with the appearance that you would like all of the forms that you will use in that particular subform. Use that form as a template for each of the others.

A naming convention also helps keep the various forms straight in you mind. For example begin the name of each related form with frm followed by a generic name for the group of forms. For each sub form, append an underscore followed by a meaningful name for the particular sub form. Using this approach, all of the related forms are listed together in the database window or navigation pane depending on your version of Access.

Summary

Using a shell form to ‘house’ the main forms of a user interface makes it easier to create and maintain a consistent ‘look’ and feel for the application.

Demonstration File

The demonsration file can be downloaded from:

Action Queries-Delete Queries

QueryDelete

Delete queries delete all records from the specified table that meet criteria specified in the query.

 

 

Scenario: The table of country names that you have inherited contains some invalid names. You have already updated the records that used to point to these names so they now point to the correct form of the relevant country name. Now you want to remove the invalid names from the table.

 

Before and After

With just a few entries, you could just open the table and delete the bad records. However, if you have many records to delete, a delete query can take care of all of them at once.

IMPORTANT: Before running a query that will modify your data, it is very important to first back up the data. You can do this either by copying the table’s structure and data or by backing up the entire database.

Setting up the query is quite straight forward. Use the table you want to clean up as the query’s record source and include the field that will determine whether or not a record should be deleted.

qdelDeleteCountriesTypos

 

This query will delete records that contain “United States” in the Country field. All other records will be untouched.

If you include additional criteria on the rows below the first criteria, then the  query will delete records that match any one of the criteria.

qdelDeleteCountriesTyposAll

 

 

 

 

 

Just to be safe, however you should not run a delete query before you view it. Notice the distinction between viewing and running the query. ViewDatasheet

 

Viewing a query will display the selected records in the query’s datasheet view.

QueryRun

Running the query, on the other hand, actually deletes the selected records.

 

Note also that double-clicking a query icon in the database window or Navigation Pane, runs the query. If you are not absolutely sure you should be running a query, open it in design view and view it in datasheet view.

Sample files for Action Queries (Access 2000 and 2007/2010 format) can be downloaded from:

 

Action Queries-Update Queries

QueryUpdate

Update queries are the means to modify record data in one or more fields in all the records that match the criteria you specify. For this article, I have modified the sample data so that it reflects an all too possible scenario.

Scenario: You have inherited a customer database where customer data was stored in a single table. You have normalized the table. When you created and populated the Countries table, you didn’t recognize that the country data inserted into the original table was inconsistent. Some country names were mis-spelled (Mxecio, United Staes, for example) and several forms of the name were used for others (US, USA, and United States, for example). The problem came to light with the Regional Manager for Mexico reported that one of more of his customers appeared to be missing when he search for customers in Mexico.

Solution: When you looked at the Countries table you recognized that the data had spelling variations for some countries. You have produced a new table with the correct spelling for each country’s name and there are no variations in the form of the name.

imageNow you want to clean up the data so that your normalized customers table will refer only to the new Countries table. You can’t simply delete the bad spellings because some of the records in your new customers table probably refer to these imagemisspelled country name records.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The solution requires first identifying which customer records refer to bad country name and then updating those records so that they refer to the correct spelling. The query results at the right is a comparative list showing the current list of country names together with a list of only valid names. In design view the query looks like this:

image 

Notice that the tables are joined by the country names, not by keys. An empty cell in the valid country column indicates that the name in the cell in the left column is invalid. This query gives us the information we need to know which records to update and what CountryID should be used for the update.

In the Customers table, these changes need to be made to the CountryID field

  • Mxeico 13 update to 12
  • United Staes 21 update to 24
  • United States 22 update to 24
  • US 23 update to 24

Because each of these updates has different criteria, four update queries will be required. (As you will see, you use a single query and simply modify the criteria after each update.) After we execute these updates, the customer table will correctly refer to Mexico and USA, respectively in the Countries table. Then the invalid names can be deleted from the Countries table.

A simple unmatched records query will help identify just the customer records that need attention. It is similar to the last query but this is what the results will look like:

image

The Is Null Criteria limits the output to just the unmatched records:

image

Now we are ready to create the actual update queries. This query will need the valid country id with which we want to update the affected Customer records:

image

This query includes the Company name field simply for “comfort.” The table requiring update is joined in this case to its related Countriesimage table so that we can restrict the record by the actual. Before running an action query it is usually a good idea to view the record selection you have specified. However, the datasheet view of an update query only shows you the field to be updated with its current value. To see more about the records that will be updated, you can temporarily convert the query to a select query and the view its datasheet.

image

Again you are only seeing the current data but you can verify that you have in fact set the criteria correctly. Now all that remains for the update is to convert the query back to its update form and then run it.

After you run the query for the first incorrect country name, you can change the query to the next misspelling, verify and run it. You simply repeat this process until you have updated the Country Id for all of the misspelled country names, one at a time.

It’s a good idea at this point to create a query to verify that the invalid country names are no longer referenced from the Customers table.

Remember: never run any data manipulation queries before backup up the affected tables and or the entire database.

Final cleanup involves deleting the records with the bad spelling. The next article in this series will discuss Delete Queries