39
1 USING MICROSOFT ACCESS WITH RCRAINFO RCRAInfo National Users Conference August 1 - 5, 2005

USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

1

USING MICROSOFT ACCESS WITH RCRAINFO

RCRAInfo National Users Conference

August 1 - 5, 2005

Page 2: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

2

This page blank

Page 3: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

3

USING MICROSOFT ACCESS WITH

RCRAINFOLink Table

Pass-Through QueryBuilding a QueryBuilding a Report

Prepared by:Buddy Jones

USEPA, Region 6(6PD-M)

Dallas, TX 75202

Page 4: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

4

What you need:

A computer (128MB or more RAM and sufficient hard drive space)

Microsoft Office or Microsoft ACCESS (97 or higher)

SQL*Net or SQL*Plus (Optional)

32 Bit Open Database Connectivity (ODBC)

SecuRemote, if accessing RCRAInfo from outside EPA

Good basic knowledge of SQL is useful:

SELECT * FROM table_name WHERE condition(s)

Good Knowledge of Microsoft ACCESSBuilding TablesBuilding QueriesBuilding Reports

Good knowledge of RCRAInfo tables and relationships (links)

Page 5: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

5

Getting started:

Install all programs needed onto computer.

Set up ODBC and SecuRemote (if necessary)

Have copies of RCRAInfo Entity Relationship Diagrams (ERD) handy

Know RCRAInfo relationships (links).

Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft ACCESS, they are called Link Tables and Pass-Through Query, both best used to import data into ACCESS data tables within an ACCESS database.

NOTE: ACCESS does not work well using “Link Table” or the “Pass-Through” Query to access data directly from external tables. It is best to import the external data into ACCESS data tables if you wish to build Queries and Reports.

Page 6: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

6

Setting up a new Microsoft ACCESS database:

Start ACCESS and click Blank Access database:

Name your new database and click Create:

Page 7: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

7

Link Table:

Log onto MS ACCESS, and click Tables:

In the white space, Right-Click and select Link Tables

Page 8: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

8

In “Files of type:” , select “ODBC Databases ()”

Page 9: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

9

Select your ODBC connector:

And enter the appropriate User ID, Password and Server information:

Page 10: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

10

When connected to RCRAInfo, scroll down to the table you desire,select and click OK:

Note: Ensure you select the tables the begin with “RCRA.”

Page 11: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

11

After the link has been established, you will see the Table namein your ACCESS Tables box with an Arrow and Globe:

Page 12: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

12

Extracting data/building tables using Link Table and Queries feature:

Select Queries New:

Select Design View and click OK:

Page 13: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

13

Select the table you desire and click ADD.

When the Table box appears in the “Select Query” area, click Close on the Show Table box.

Page 14: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

14

Choose the fields you wish to extract or the Asterisk (*) for all fields.

On the Tool Bar, click the Exclamation Point (!), to run your query.

Building a table will be covered later in this presentation.

Page 15: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

15

The Pass-Through Query

A Pass-Through Query is a Microsoft ACCESS query that uses the ODBC to access and get data from external data sources

After starting ACCESS, click on Queries New:

Page 16: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

16

Select Design View:

Close the Show Table box.

Page 17: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

17

On the Tool Bar, select Query SQL Specific Pass-Through

You then get a blank SQL Pass-Through screen:

Page 18: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

18

Enter your SQL statement in the Pass-Through Query box:

On the Tool Bar, select the Properties icon (the HAND grabbing apiece of paper):

Page 19: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

19

Click in the gray area to the right of the ODBC Connect Str box:

Select your ODBC connector:

Page 20: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

20

Enter the appropriate User ID, Password, and Server information

Click OK.

You will be asked if you wish to “Save the password in the connection string?”

Answer Yes.

Close the Query Properties box

The Pass-Through Query is now set up. Save the query with an appropriate name, such as the Table name and the words “Pass-Through”:

Page 21: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

21

Building tables / extracting data using the Link Table or Pass-Through query:

To build a table, you must use the Make-Table feature of Queries. Click on Queries New:

Select Design View:

Page 22: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

22

Select either “Tables” or “Queries” in the Show Table box, depending on whether you choose to use a Linked Table or a Pass-Through query.

In this example, we’ll use the Pass-Through query to HREPORT_UNIV3. Choose the appropriate item and click Add.

When the the table box appears in the Select Query area, close the Show Table box.

Page 23: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

23

As before, select the field(s) you desire to pull, or the “*”. After setting any criteria and/or sort conditions, click the Query Type icon on the Tool Bar and select Make-Table Query

You will be asked to name the table you are making. After naming your table, click OK.

Page 24: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

24

To run your query and make the new table, click the Red Exclamation Point ( ! ) on the Tool Bar.

This process retrieves the data from RCRAInfo, and automaticallysets up the Table Structure. You must use ACCESS’s Queries and/or Reports feature to generate another query, and/or generate a report, particularly if you are going us more than one table.

Save your new query:

Page 25: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

25

Refreshing Linked Tables:

Each time you exit Microsoft ACCESS, your Linked Table connection to RCRAInfo will probably be lost. Therefore, you should refresh the connection before attempting any future updates to your tables. It is a simple process and only takes a few minutes.

Note: If you attempt to update your tables and don’t refresh the connections as needed, you might get an ODBC failure error. If you continue to get an ODBC failure error, there is probably anotherproblem not related to ACCESS. Check your ODBC set up to ensureit has not corrupted. Check to make sure that RCRAInfo is not down. If you are using Securemote, check to ensure that connection is working properly. If these are OK, take a deep breath, go get a cup of coffee, and try again later.

Select “Tools” on the Tool Bar, then select “Database Utilities” and “Linked Table Manager”.

Page 26: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

26

The Linked Table Manager selection box will appear. You will see only those tables for which you have established a Link.

You may select individual linked tables to update by clicking the box to the left of the table name. Or you can select all tables be clicking “Select All”. Select the “Always prompt for new location” box. After you have made your selections, click “OK”.

The Select Date Source box will appear. Select the appropriate ODBC by double-clicking (or single-clicking and then click “OK”.)

Page 27: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

27

You will be prompted to enter your User Name, Password, and the Server. If you have preset your User Name and Server in your ODBC setup, these should be pre-filled. After entering the appropriate

information, click “OK” and your Linked Tables connections will be refreshed. This will table a few minutes.

You will get a pop-up message when the process has completed.

Click “OK” on the pop-up box. Then click “Close” on the Linked Table Manager selection box. You may then continue on with updating your tables.

Page 28: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

28

Building a Query

As you did when making a table, select Queries New Design View and click OK:

Page 29: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

29

Select the ACCESS table(s) you wish to use, and click Add.

NOTE: Ensure you select the appropriate TABLE and not a “Link Table”.

After selecting the table(s) you with to use, and it/they appear in the “Select Query” area, click Close on the Show Table box.

Page 30: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

30

To link multiple tables, hold down the left mouse button and drag from the linkable field in one table to its related field in the other. Example HANDLER_ID in CEVALUATION3 to HANDLER_ID in HREPORT_UNIV3

To define the relationship, double click on the Link line and it will Bold.

Page 31: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

31

In the Join Properties box, choose the appropriate relationship you desire and click OK.

Note that the Link line changes to an arrow, pointing from one field to it’s related field based on the property you assigned.

Page 32: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

32

After selecting any criteria and/or sort you desire, click the Run icon (!):

Save your query with an appropriate name.

Queries allow you be better qualify criteria, such as concatenating fields, using IF..THEN statements, etc.. Building a query first aids in generating a report.

Page 33: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

33

Building a Report

Select Reports New.

In the New Report box, select the report feature you desire, and the table or query name you are going to use. Click OK:

In this example, we are using Report Wizard to “automatically” build our report using the DEMO QUERY.

Page 34: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

34

Select the fields you desire by double-clicking on the field name, or by using the arrows to move the field name(s). Then click Next.

Or you can use the single or double arrows ( > or >>)

for one or all fields

You can add grouping level(s) to you report.

Click Next:

Page 35: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

35

You can pre-select sorting.

Click Next:

Select the basic Layout and Orientation you desire.

Click Next:

Page 36: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

36

Choose a pre-built Style for your report.

Click Next.

Give your report a name:

Click Finish.

Page 37: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

37

And . . .

The report generates.

To modify the report’s appearance, click the Design View icon (Carpenter’s Square) on the Tool Bar:

Page 38: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

38

You can then change the appearance of your report and design it as desired.

The report saves automatically when first built. When exiting, you should be prompted to save if you have made any changes.

Page 39: USING MICROSOFT ACCESS WITH RCRAINFO · 2018-08-16 · Microsoft ACCESS offers two methods for accessing SQL database tables or data from “external” ODBC sources. In Microsoft

39

END OF PRESENTATION

RCRAInfo National Users Conference

August 1 - 5, 2005