introduction to microsoft access danielle zammit b.pharm. (hons.), m.s.(pharm.)

25
Introduction to Microsoft Access Danielle Zammit B.Pharm. (Hons.), M.S.(Pharm.)

Upload: malcolm-bates

Post on 28-Dec-2015

227 views

Category:

Documents


3 download

TRANSCRIPT

Introduction to Microsoft Access

Danielle ZammitB.Pharm. (Hons.), M.S.(Pharm.)

Steps

Some background on Access and why it is used

Some basic definitions Different Components of Access Creating an Access database with

pharmacy claims data Extracting useful information to

address specific questions

What is Microsoft Access?

Relational, multi-user database management system that runs on the Microsoft Windows platform

Relational: data stored in one table can be related to data stored in another table within the structure of one database

Multi-user: more than one person can access the same data at the same time.

Why Access?

InexpensiveRelatively Easy to UseLimitations of ExcelPowerful functionality that can

be learned gradually

Some Basic Definitions

Database: A repository of information e.g. A file containing all the claims records of the members

of a health plan

Table: A collection of information relating to a specific category

e.g claims by therapeutic class

Record: A collection of information about one object in the table

e.g. each patient has a record Field: A specific category of information in each record

e.g. client name

Components of Access

TABLES: Store data in rows and columns

QUERIES: Extract, summarize and alter table contents

FORMS: templates for altering and viewing table data

REPORTS: Display information in an accessible format

MACROS and MODULES: Automate processes and create custom functionality

Components of Access

Demonstration

Tables: - Design View

- Datasheet View

Queries: - Design View

- Design Grid

- Running a Query

- Totals

Creating an Access DatabaseStarting up

Start AccessChoose to create a new, blank

databaseSpecify the directoryGet the data

Three basic methods:

1. Create a table from scratch

2. Import or link to external data

3. Create a table from other information already in the Access database

Creating an Access DatabaseGetting the Data

Select “File/Get External Data/Import

Select appropriate file type

Point to appropriate file in appropriate directory

Creating an Access DatabaseImporting Data

For text files The “Import Text Wizard” dialog box will

appear and you can see your data

Choose (for this dataset):- Comma delimited, first row contains field

name- Create in a new table, let Access choose the

primary key- Specify the name e.g. “RawData”(Demonstrate with example)

Creating an Access DatabaseImporting Data

Click the “Queries” tab, the “New” button, then “Design View”

Select the table (and or query) that you want to base your new query on

Double click, or drag, each filed that you want into the design grid

Hit the red exclamation mark

Extracting InformationCreating a Query

Extracting InformationThe Criteria Row

E.g Create a query that selects patients who have only filled one prescription

Put MBR_ID and DRUG in the Design Grid Save the Query as MonoMbrsPrep Now create a new based on the query MonoMbrsPrep Click the symbol Group by MBR_ID and count DRUG Use Criteria to include those records where Count of DRUG

is 1 Run the Query Save the Query as MonoMbrs.

Extracting InformationCreating a Custom Function Right click in an empty Design Grid

column Select “Build” Expand “Functions” then “Built-in…..” In the far right column, find and double-

click on the function you need E.g. Max (<<expr>>)” appears in the

“Expression Builder box

Extracting InformationCreating a Custom Function Click on “<<expr>>” In the lower left hand column, select

“Tables” or “Queries”, depending on the filed you want

Double-click on the field you want in the middle column

Extracting InformationLinking queries to create another

E.g. Create a new query based on MonoMbrs, RxSpan and Quantity

Click on MBR_ID in MonoMbrs and drag it on top of MBR_ID in RxSpan

Repeat this step, but now drag it on top of Quantity

Only members common to all tables will be included as output

Extracting InformationCreating a Table

Click the “Tables” tab Click “New” Select “Design View” Type “Drug” in the “Field Name” column Specify “Text” as the type Provide a useful description

Extracting InformationCreating a Table

Create the “MinEffDose” in the same way except specify the type as “Number”

Save the table as MinEffDose No need for a primary key Select the “Datasheet View”. Specify the following minimum doses:

– Paxil:10 – Prozac: 20– Zoloft: 50

Extracting InformationUsing Tables and Queries E.g. calculating the percentage of the minimum

dose taken by patients - Create a new query based on the tables

RawData, MinEffDose and the query:AvgDailyDose

- Join RawData and AvgDailyDose on MBR_ID- Join RawData and MinEffDose on DRUG- Put MBR_ID, DRUG, SPAN and MINEFFDOSE

in the Design Grid

Extracting InformationUsing Tables and Queries- Create a field “PercentDose” as a custom

function: PercentDose = ([AvgMG])/ ([MinEffDose])

- Run the Query to check if it works- Avoid Duplicate Records:

– Go Back to Design View

– Right Click in the area where the tables are

– Select “Properties”

– Change “Unique Values” to “Yes”

Extracting InformationUsing Tables and Queries- Format the “PercentDose” Field:

- With the “Properties” Window still open click in the “PercentDose” column

- Select “Percent” in “Format” field

- Select zero decimal places

- Run the Query to check if it works- Save the Query as SpanDose

Extracting InformationMaking a Table from a Query

Open the query e.g. SpanDose. Go to Design View and Right Click in

the area where the tables are Click the “Query” menu item and select

the “Make-Table Query” Type the name of the table when

prompted, “SpanDose”

Extracting InformationMaking a Table from a Query

Run the Query to check if it works Save the Query as

SpanDoseMakeTableQry

You should now have in your database: a new table, a new makeTable query and the original SpanDose query.

Biostats Lab

You will practice and get more familiar with all these techniques in the lab