|
Forms & Reports: |
![]() Did you want: Working with Databases: Access 2007, 2010, 2013, 2016 | ||||
|
![]() |
Now that you have created a number of Access objects, you will likely need to share your data and reports with others. Printing is still a great way to share, but there are several other methods. Since a database object exists only as part of the database, you must convert the object to a different format or else export it to another database. The same methods will work for tables, query datasheets, forms, and reports, but the formats available are a bit different for each type of object.
|
![]() |
Project 4: Forms & Reports
| |||||||||||||||
Formats for Exporting Access ObjectsThe formats that you can choose from vary, depending on the type of object you are trying to export. The most commonly used export formats are probably Text (as comma- or tab-delimited), Excel, and dBase. The exported file may not contain everything that you had in the Access object. For example, OLE objects like photos and embedded spreadsheets are not exported except in Snapshot Reports and possibly some database formats. The formatting you have applied may not be exported. Calculated fields do not export as calculations but as values in most formats. To verify that your object was exported correctly, you must have software that can open the file! There are many opportunities for problems here!!
|
![]() |
Step-by-Step: Sharing Reports |
![]() |
What you will learn: |
to email a report as an attachment to export a report as a file in various formats: Excel format RTF format HTML format Text format Snapshot format to save a report as a data access page |
Start with:
,
resource files,
worldtravel.mdb, reports from previous
lessons
Now that you have several reports saved, you can practice the various ways besides printing that you can share them the people who cannot view the database themselves. These same methods work for other database objects.
You will not try out every variation of every method! The key is to remember to think about what software your user has. Pick a method that produces a document that they can open! You should also consider what the data will look like in the new format. Access tries to preserve the look of reports, but some formats make that easier than others.
You need three things in order to use the Sent To command to email an Access object directly from Access:
Computer which is attached to the Internet or network
Email account correctly set up on that computer in an email client which handles MAPI messaging, such as Outlook or Microsoft Exchange or Microsoft Mail, but not Outlook Express
Email address of someone to whom to send the message
You can skip this section if you do not have such an email account set up on the computer that you are using.
Problem:
Message was not sent
You may or may not see an error message if your email account
exists but is not configured correctly. The message will be saved
in the Outbox.
If you do not have an email account set up in an appropriate email program, you will not be able to send the message, but you will be able to save it. That's not much help unless you can create an email account later to send it with!
In
the Database Window, select the report Trips by
Agent - Cumulative Total.
From the menu select
The Send dialog opens with a list of formats.
Select
Rich Text Format and click on OK.
A box appears briefly that says Printing in the title bar and in the
message "Now outputting 'Trips by Agent' to a mail message'.
Outlook will open a new message window, ready for you to enter an address, subject,
and message.
Outlook is
required or another email program that can handle MAPI, even if Outlook is not your usual email client.
Enter your own email address in the To... box.
Yes, you can email yourself from your own account!
(Please do not email your attachments to me! That would
overwhelm my email account.)
In the subject line type Sending
Report as RTF.
In the Message area, type a short note to
yourself.
Click the Send button.
Check your
email until you get the message.
Open the attachment
by double-clicking the name of the attachment.
A message
will probably ask you to confirm that you want to open the attachment.
You may see other security warnings, depending on your settings and
security software.
The
file opens in Word or whatever word processing program is associated with
the file type Rich Text Format (*.rtf).
This format keeps the text formatting of the original. Sometimes some
formatting is lost but usually you get a good result with RTF.
No photos or other OLE objects are exported when you choose RTF format.
Happily, this report did not have any, so nothing was lost.
Save the RTF file to
your Class disk in the folder databases project4.
You will export a report using several different file formats to see what the differences are.
Excel Format:
In the Database Window, select the report Trips by
Agent - Cumulative Total.
From
the menu select |
The Export dialog appears.
Navigate
to your Class disk to the folder databases project4.
Choose as the file type,
Microsoft Excel 97-2003 (*.xls)
Report exported in Excel format
RTF Format:
Report exported in RTF format
HTML Format:
Do not confuse an exported HTML document with a data access page. Both are web pages in HTML format, but a data access page reaches into the database to use the current data every time it is opened. Exporting an object in HTML format produces a page that is frozen in time. It will not change if the data in the database changes. That may be just what you want!
Report exported as HTML
Text Format:
Report exported as Text
Snapshot Format:
Report exported in Snapshot format
A data access page is a web page that links directly to the database for its data. Users can be allowed to edit the data themselves. Of course, for a report, there would be no editing. But the report does reflect the most recent data changes and would change the next time it was viewed if the data had changed in the meantime! That could be quite useful.
Select
the report Trips by Agent- Cumulative Total
in the Database Window.
From the menu select
The Save As dialog appears with the name Copy
of Trips by Agent - Cumulative Total filled in and the As box
shows Report be default. (That is why the default name starts with 'Copy
of'.)
Since you already have a page named Trips by Agent-
Cumulative total.html from your export above, leave name as
suggested by Access.
Change the As text box to Data Access Page.
Click
on OK.
The New Data Access Page dialog appears, looking remarkably
like a Save As dialog. Your Class disk folder for this project is
already in view.
Only 1 file is showing. The file type is set to HTML files and there is
only one of those in the folder already.
The report is saved as Copy of Trips by Agent -
Cumulative Total.htm and automatically opens in a window inside
Access. That's a change!!
Expand each of the Agent groups on this page by clicking the +
buttons for each agent, partially hidden by the agent's name.
This looks nice, until you look carefully! The Cumulative Total column is not accumulating. It is showing just the Net Price for the particular trip. The Net Price Total shows an error, #Name? Scroll to the bottom of the page and you will see that the Grand Total and Grand Total Net are both blank.
Recall that the Cumulative Total column is supposed to show the Net
Price values, with Running Sum set to Yes, making the values accumulate.
The Net Price for each trip is calculated with the expression
=[Price]-([Price]*0.01*[Discount %]).
Apparently a data access page has a problem with running sums and
sums of calculated fields.
There is a way
around the total issue using a bound span control, which special to data
access pages but not the running sum. If you are interested, see the
Help article 'Calculate a total or other aggregate values' and open the
directions under 'Calculate a total or other aggregate values on a data
access page'.
Shortcut
to Data Access Page: The Database Window's Pages section will not
show a shortcut to your new data access page until after you close the
page.
![]() |
~~ 1 Cor. 10:31 ...whatever you do, do it all for the glory of God. ~~ |