Download Section 10 - ODBC and Access Reports

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

IMDb wikipedia , lookup

DBase wikipedia , lookup

Tandem Computers wikipedia , lookup

Relational algebra wikipedia , lookup

Oracle Database wikipedia , lookup

Concurrency control wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Btrieve wikipedia , lookup

Ingres (database) wikipedia , lookup

Microsoft Access wikipedia , lookup

Database wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Clusterpoint wikipedia , lookup

SQL wikipedia , lookup

PL/SQL wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Transcript
ODBC REPORTS
How to Use Access to work with MS SQL Server Database
Open This folder
Open Access
Open a blank
database
Give the DB an
appropriate name.
Open the External
Data menu
Click on the ODBC
Database
ODBC stands for Open Database Connectivity
ODBC is Microsoft's strategic interface for accessing data in a heterogeneous
environment of relational and non- relational database management systems.
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.
A new DSN (data source
name) Name has to be
created.
1. In this example it is:
Oasis Instance Link. You
can choose any name you
like.
2. Click on New
1. Scroll down and choose
SQL Server
2. Click Next
1. Once again I chose
Oasis Instance link.
2. Click Next
Click Finish
1. I have described the
data source as Oasis
2. The server is alar\oasis
3. Click Next
1. Use Windows NT
Authentication
2. Click Next
Choose your database as
the default.
Click Next
Click Finish
Test the Data Source
1. The result should read
like this.
2. Click OK
Click OK
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
The tables from the
default database should
now appear.
Click OK
1. I highlighted the four
tables I wanted to use.
2. Click on Database Tools.
These four tables now
appear in Access.
1. Table 1 can be deleted.
The relationships between the
tables now have to be established
All tables are highlighted.
Add the tables to the
Relationship window.
The relationships between
the tables are now
established
Once the relationships are established,
queries can now be created. A query will
be created in order to produce a report.
Select the query wizard.
Close this window.
Right Click on Query 1 and
select the SQL view.
This is the SQL view
I want to produce a Sales Report
SELECT c.CustomerNumber, c.CustomerLastName,
iln.InvoiceNumber,i.SaleDate,sum(iln.QuantitySold * inv.SellingPrice) as Total
from dbo_CUSTOMER c, dbo_INVOICE i, dbo_INVOICE_LINE_ITEM iln, dbo_INVENTORY inv
where c.CustomerNumber = i.CustomerNumber
and i.InvoiceNumber = iln.InvoiceNumber
and iln.InventoryNumber = inv.InventoryNumber
GROUP BY iln.InvoiceNumber, c.CustomerNumber, c.customerlastname,i.SaleDate
ORDER BY c.CustomerNumber, iln.InvoiceNumber
Notice the ‘dbo’ in front of each table name.
The actual names of each table are preceded
by ‘dbo’
The SQL is structured in the same manner
as SQL SERVER
To run the query
This query will now be used to generate a
report using the Report Wizard.
Click on the Create
Menu.
1. Save the query
2. Run the Report
Wizard.
All lines will be
selected.
Click Next
A grouping by
CustomerNumber
No sorting since the SQL
already pre-sorted the
query.
Stepped lay out
The name of the
report.
Click on the Design View to
change the format of the
report.
I want to create a Sales Invoice
Notice the concatenation.
Access uses ‘&’ instead of
CONCAT
The initial report looks like
this.
Original Design View
The New Design View
The Invoice