Professional Documents
Culture Documents
Remember: Excel for crunching numeric data. Access for organizing and analyzing text data
An Access database can contain multiple tables. Each table contains records (groups of related fields) and Fields
(groups of similar information). In addition to tables, a database will contain Queries, Forms, Reports and Macros.
The screenshot below shows a table in design view (the tables metadata is visible).
Database parts:
Forms – used for data entry (easier to look at than table or query)
Table in Design view (field names in yellow, metadata for selected data visible)
Page | 3
1. Naming conventions help organize a database. The person maintaining the database (you) will know
where to look for stuff and more importantly, what you’re looking at (tables should begin with tbl.
Queries should begin with qry, Forms should begin with frm and Reports should begin with rpt.)
2. Names should be descriptive (use words!)
3. Don’t use spaces in database object names (use capital letters to help identify individual word.
Due: qryCustomersAndInvoice
Don’t: qry Customers and invoices Why? When referencing, prone to typos
Don’t qrycustomerandinvoice Why? Difficult to read
Why?
By using a logical and organized naming convention, it is quite easy to navigate through the various database
objects (it’s easy to find the query or table required for a specific form or report).
Advanced Pattern Match Queries: Up until now, most of the queries that we have worked with
(CCCL 100) have used the basic comparison operators (<,>,=). While these are good for exact matches or numeric
values, they don’t work very well with data that is in a text format.
The Like format is useful when the search involves a pattern. Suppose you have a database of pets with a field
titled “Animals”. If you wanted to filter the data for only dogs, you could use the like function with a dog filter: Like
“dog”. This would return every record that contain only dog. The problem with this statement is that it would
eliminate any field that had more than just the value of dog. For example: any field that had “big dog” or “little
dog” would not be included in the query (why? The like returns an exact match).
Access allows the use of wildcards to help with this type of situation. The wild card, when used with the like
function, really opens up your search options!
2009
There are times when you’ll want to run a match for multiple criteria in a query (for example, you want to return
those customers living in Adams, North Adams and Savoy). While you could spread the criteria over three different
or lines, it would be easier to write a single line of code to perform the same function. In this example, right click in
the criteria field on the city field and select “Zoom” and a window will pop up that will allow you to enter in all of
your criteria at the same time.
List-of-Value queries use a list to define the query criteria - While the or criteria works when there are only two
items, the lists come in handy when there are more than two items. The List function is used in the screenshot
bellow.
Using the “Not” logical operator will exclude the the items from query results. In the screenshot below, all of the
results execpt for the items in the list.
Autofilter:
Remember using the Autofilter function in Excel? Access is no different. Enough said.
Page | 6
In the example they’re using in the book, they create a title field that will conditionally return a result that will
either contain the customer name (first and last name) or the company name (if the customer name doesn’t exist)
The only difference between the IF function in Excel and Access is the spelling (IIF in Access vs IF in Excel), all of
the other arguments are the same.
General format:
Screenshot:
Parameter Querys: The power of this type of query is that it prompts the user for the filter criteria when
the query is run (during run time). To set up a parameter query, use brackets to enclose the prompt to be
displayed. In the examples below, the parameter query as it appears in the design view of a query and as it
appears in the Parameter dialog
Crosstab Queries: Why? When somebody (your boss) what’s to see something grouped by . . . you will need
to use a crosstab (in Excel, it was the crosstab table, in Access, it starts with a crosstab query). For example, a
summary of sales by city would provide an aggregate total of sales by city.
Page | 8
Finding duplicate queries: This is a great tool (select query wizard and select duplicate query from the
option menu). There are times when you may suspect that a set of data contains duplicate values (why? It
happens . . . ). If the dataset is small (20 names), it’s easy to spot the duplicates. If, on the other hand, the dataset
is quite large and complex, it can become quite difficult to find the duplicate records.
There are times when the field of a record will have the same value (just look in the phone book under the last
name of Smith or Jones). A duplicate record would have the same value in multiple fields (for example, first name,
last name and phone number).
When looking for duplicate records, make sure that the values from multiple fields are selected and compared!
Finding Unmatched values: The unmatched queries are useful for isolating inactive records. The query
wizard will walk you right through the process (select new query and click on the unmatched query option to bring
up the wizard, which will walk you right through the steps.)
Again, the value of this tool is based on the criteria used to build the results. Even using the wizard will allow you
to create quite complex unmatched queries.
The Find unmatched query wizard will guide you through the process:
Select the two tables to be compared
Idenfitied the common value between the tables
Select additional fields (provides context for results)
Click finish
Lookup Fields
Bottom line: people mess up data entry. It is amazing how many ways people can mess up a state name . . .
Solution: Lookup fields. With a lookup field, the user selects from a list of preset options –
Page | 10
Lookup options
Page | 11
Inputmask wizard:
The person entering data into
the database will use the
input mask to provide
valuable feedback about the
type of data being entered
into a specific field. Again, the
tutorial in the book will walk
you through the process for
applying an input wizard.