Top Banner
ODBC REPORTS How to Use Access to work with MS SQL Server Database
53

ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Dec 27, 2015

Download

Documents

Harold Bruce
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

ODBC REPORTSHow to Use Access to work with MS SQL Server Database

Page 2: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Open This folder

Page 3: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Open Access

Page 4: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Open a blank database

Page 5: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Give the DB an appropriate

name.

Page 6: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Open the External Data menu

Page 7: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click on the ODBC Database

ODBC stands for Open Database ConnectivityODBC is Microsoft's strategic interface for accessing data in a heterogeneous environment of relational and non- relational database management systems.

Page 8: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click on this button.This gives an active link with the Microsoft SQL Server

database. Any changes made in Access will be reflected in the SQL Server database.

Page 9: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

A new DSN (data source name) Name has to be

created.

Page 10: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

1. In this example it is:Oasis Instance Link. You

can choose any name you like.

2. Click on New

Page 11: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

1. Scroll down and choose SQL Server

2. Click Next

Page 12: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

1. Once again I chose Oasis Instance link.

2. Click Next

Page 13: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click Finish

Page 14: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

1. I have described the data source as Oasis

2. The server is alar\oasis

3. Click Next

Page 15: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

2. Click Next

1. Use Windows NT Authentication

Page 16: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Choose your database as the default.

Page 17: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click Next

Page 18: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click Finish

Page 19: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Test the Data Source

Page 20: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

2. Click OK

1. The result should read like this.

Page 21: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click OK

Page 22: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

1. You are now returned to the ODBC data source

window. Scroll through and choose the link to Oasis. In this example I set it up as

Oasis Instance Link.

Click OK

Page 23: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The tables from the default database should

now appear.

Page 24: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

1. I highlighted the four tables I wanted to use.

Click OK

Page 25: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

These four tables now appear in Access.

1. Table 1 can be deleted.

2. Click on Database Tools.

Page 26: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The relationships between the tables now have to be established

Page 27: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

All tables are highlighted.

Add the tables to the Relationship window.

Page 28: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The relationships between the tables are

now established

Page 29: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Once the relationships are established, queries can now be created. A query will be created in order to produce a report.

Page 30: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Select the query wizard.

Page 31: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Close this window.

Page 32: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Right Click on Query 1 and select the SQL view.

Page 33: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

This is the SQL view

Page 34: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

SELECT c.CustomerNumber, c.CustomerLastName, iln.InvoiceNumber,i.SaleDate,sum(iln.QuantitySold * inv.SellingPrice) as Totalfrom dbo_CUSTOMER c, dbo_INVOICE i, dbo_INVOICE_LINE_ITEM iln, dbo_INVENTORY invwhere c.CustomerNumber = i.CustomerNumberand i.InvoiceNumber = iln.InvoiceNumberand iln.InventoryNumber = inv.InventoryNumberGROUP BY iln.InvoiceNumber, c.CustomerNumber, c.customerlastname,i.SaleDateORDER BY c.CustomerNumber, iln.InvoiceNumber

I want to produce a Sales Report

Notice the ‘dbo’ in front of each table name. The actual names of each table are

preceded by ‘dbo’

Page 35: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The SQL is structured in the same manner as SQL SERVER

To run the query

Page 36: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

This query will now be used to generate a report using the Report Wizard.

Page 37: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click on the Create Menu.

Page 38: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

2. Run the Report Wizard.

1. Save the query

Page 39: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

All lines will be selected. Click Next

Page 40: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

A grouping by CustomerNumber

Page 41: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

No sorting since the SQL already pre-sorted the

query.

Page 42: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Stepped lay out

Page 43: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The name of the report.

Page 44: ODBC REPORTS How to Use Access to work with MS SQL Server Database.
Page 45: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Click on the Design View to change the format of the

report.

Page 46: ODBC REPORTS How to Use Access to work with MS SQL Server Database.
Page 47: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

I want to create a Sales Invoice

Page 48: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Notice the concatenation. Access uses ‘&’ instead of

CONCAT

Page 49: ODBC REPORTS How to Use Access to work with MS SQL Server Database.
Page 50: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The initial report looks like this.

Page 51: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

Original Design View

Page 52: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The New Design View

Page 53: ODBC REPORTS How to Use Access to work with MS SQL Server Database.

The Invoice