0% found this document useful (0 votes)
19 views59 pages

Alpha 12

Uploaded by

darkobozin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views59 pages

Alpha 12

Uploaded by

darkobozin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 59

1

Alpha Five Web Applications for Access Developers

AlphaSoftware.com

Alpha Five Web Applications for


Access Developers
by Martin Heller, VP of Education and Technology, Alpha Software
While Access 2010 builds on the strengths of previous
versions of Access for desktop applications, many
developers have been looking for better alternatives for web-
enabling their Access databases. One such alternative is to
use Alpha Five, which can use the existing Access database
directly and allow you to build web applications from it
quickly and easily.
In this white paper, you will learn how to move a Microsoft
Access desktop application to the Web with Alpha Five.
You’ll see how easy it can be, and when you’re done you’ll
understand the process well enough to undertake it yourself.
This paper is intended to be a hands-on tutorial. You’ll get
the most out of it if you follow all the steps on your own
computer.
Working with an Access Database from Alpha Five
Let’s start by showing you some of the things you can do with an existing
Access database from Alpha Five, using Northwind.mdb as an example.
Install Alpha Five
Before you can begin, you need to have Alpha Five installed on your
computer. It has to be a Windows computer, or at least a Windows
environment running on another computer (say, on a Macintosh running
Boot Camp, Parallels or VMWare Fusion), and the Windows version should
be Windows XP or later, including Windows Vista, Windows 7, Windows
2003 Server, and Windows 2008 Server.
Open your favorite Web browser and browse to
http://www.alphasoftware.com/trial/v10/. Fill out the form and click
the “Download Free Trial” button. Now you can download and save the
Alpha Five installer by clicking on the download link.
When the download completes, run the saved installer, and accept all the
defaults. If you have already bought a license for Alpha Five and have also
bought the Flying Start Genie Feature Pack, enter and activate it now;
otherwise, proceed with the free 30-day trial. Should you find that you
need more than 30 days to complete your evaluation, you may contact
Alpha Software for an extension.Alpha Five Web Applications for Access
Developers AlphaSoftware.com 2
Connect to the Northwind Access Sample
Start Alpha Five and create a new, empty “database” in a new directory of
your choice. My Documents\Alpha Five V11\NorthwindAccess\ was
my choice for the folder, and Northwind was my choice for the
“database” file name (actually the master project name, as Alpha Five
projects are managed from an ADB database).
From Windows Explorer, copy Northwind.mdb to this directory from C:\
Program Files (x86)\ a5V11\MDBFiles\ on a 64-bit system or C:\
Program Files\a5V11\MDBFiles\ on a 32-bit system.
Note: For a more complete introduction to Alpha Five V11 that
covers the material in this section with copious illustrations, see
Chapter 1 of the Alpha Five V10 Web Tutorial.

Now we are going to create a connection to the Northwind database that


we can use later to build web components and reports.
Switch back to Alpha Five. Open the Web Projects Control Panel if it is
not already open; if doesn’t have focus, select it. If you get a Startup
Control Panel dialog, check the box that tells Alpha Five to always Open
the Web Control Panel when this Database is opened and press OK.
Pick the Edit|Manage Connection Strings|AlphaDAO Connection
strings menu item from the Alpha Five menu bar. You’ll see the
AlphaDAO Connections dialog. Alpha Five Web Applications for Access
Developers AlphaSoftware.com 3
Click on New at the bottom of the dialog. You’ll see the New AlphaDAO
Connection dialog. Click on the Build button, and you’ll see the Create
SQL Connection String dialog. The Access connection type should be
selected by default. Click on the folder icon of the File Name field and
select Northwind.mdb. Test the connection: it should say Succeeded.
Click OK to get back to the New AlphaDAO Connection dialog. In the
Connection Name field, type “nwa” (a short mnemonic for Northwind
Access). Now click OK to save the named connection string, and Close to
dismiss the AlphaDAO Connections dialog.Alpha Five Web Applications
for Access Developers AlphaSoftware.com 4
When you start working with your own Access database, the process will
be much the same. If you like, create a second connection string in this
project for your own database, saved under a name that is meaningful to
you. You can either navigate to the current location of the database when
you create the connection string, or copy the database to a working folder
(so that you can’t corrupt the original), such as the My Documents\
Alpha Five V10\Northwind Access\ folder to which we copied
Northwind.mdb.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 5
Create a grid against the Customers table
Select the Web Components filter of the Web Projects Control Panel
and press the New button.
Select Web Component, press Next, and select Grid.
Press OK, select SQL, select Create Grid Component from a Template,
select Grid with Updateable Detail View (SQL), and uncheck Open help
window.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 6
Press OK. In the Grid Builder, select the named nwa connection and
connect to it. Select Table or View and the Customers table.Alpha Five
Web Applications for Access Developers AlphaSoftware.com 7
Select the Component Type and check Grid contains a ‘Search’
part.Alpha Five Web Applications for Access Developers AlphaSoftware.com
8
Select Grid|Fields, select the CustomerID, CompanyName, City, and
Country fields, and add them to the Grid using the > button.
Select Search|Fields, select the CompanyName, City, and Country
fields, and add them to the Search part using the > button.Alpha Five
Web Applications for Access Developers AlphaSoftware.com 9
Select Detail View|Fields, select all the fields but the last two, and add
them to the Detail View part using the > button.
Click on the Working Preview tab to see what we’ve done so far. This
view is completely live, so you can scroll through the tabular grid, search
the customers, view the details for any customer (by clicking on the
underlined CustomerID field), and edit the current detail view.
Press the Save button in the top toolbar, and call this grid Cust1.Alpha
Five Web Applications for Access Developers AlphaSoftware.com 10
Create a row expander drilldown for Orders
Wouldn’t it be nice to drill down in a given customer to see the related
orders? We can do this easily by creating a grid for Orders and adding it
to Cust1 as a row expander.
Switch to the Web Projects Control Panel and create a new Grid
component. This time, make it a Read-only Grid (SQL), and choose the
Orders table. Pick all of the fields except the last two.Alpha Five Web
Applications for Access Developers AlphaSoftware.com 11
Switch to the Working Preview tab. Save this as Ord1.
Switch to the Cust1 grid builder Design tab Grid Properties. Scroll
around halfway down (or search for “row expander”) and check Has row
expander.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 12
Open Row expander linked Grids using the … button at the right of the
property. Add grid Ord1 with parent field CustomerID linked to child
field CustomerID.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 13
Click OK, save the grid, and switch to the Working Preview pane. Now
you should be able to click on any plus sign to drill down to the orders for
a customer.
Note that we could have defined multiple grids to display in the row
expander; they would be organized by tabs. We could also define a row
expander for the child grid on the Orders table, to open a grandchild of
the Customers table. We’ll demonstrate another capability instead.
Create a linked content area for Order Details and Employees
A linked content area is another place for a linked grid. Rather than
opening below the current row, the linked content area opens in one of
the four Freeform Edit Regions above, below, left, and right of the grid.
For this exercise, we’ll open two linked grids in the region below the
Orders grid.
Create a new read-only grid against the Order_Details_Extended view
in Northwind, and Alpha Five Web Applications for Access Developers
AlphaSoftware.com 14
add all but the last two fields to the grid. Preview this and save it as
Ord_det_ext1.
Create another new read-only grid against the Employees table in
Northwind, and add all but the last five fields to the grid. Preview this and
save it as Emp1.
Open grid Ord1 for editing, view the grid properties, scroll down to the
Linked Grids/Content section, and check Has linked Grids or other
content. Click on the … button to the right of the property. In the Linked
Content Builder, click Add Linked Content Section, and call the
section ORD. Click Define Linked Content, and add the grids
Ord_det_ext1 (linked on OrderID) and Emp1 (linked on EmployeeID)
to the section. Set the Initial Grid number to display to 1.
Press OK. Press the Edit ‘Freeform Edit Region’ button, and bring up
the Bottom region. Double-click on the ORD section to add it to the
region.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 15
Press OK twice, save your Ord1 grid, and view it in Working Preview. You
will see the two grids in the linked content area below the grid. The linked
grid content will change with the selected order, and you can click on the
tabs to view each linked grid.Alpha Five Web Applications for Access
Developers AlphaSoftware.com 16
Now open your Cust1 grid and look at its Working preview. Remember,
Cust1 already had Ord1, which we just modified, in its row expander.
Expand a row and you will be able to drill down from a customer to the
customer’s orders to an individual order and the employee who took the
order.Alpha Five Web Applications for Access Developers AlphaSoftware.com
17
Pretty neat, don’t you think?
There is nothing keeping you from, say, adding a row expander to
Ord_det_ext1 to show Products, linked on ProductID. The grids can
easily follow the relations in the database for a natural data browsing
experience.
This would be a good time to try to create some grids against your own
Access database. Identify some parent-child-grandchild relationships and
create row expanders or linked grids for drilldowns. Don’t overdo it – later
in this paper we’ll learn a shortcut for building grids against tables and
views.
While we have barely scratched the surface of what can be done with
Alpha Five grids, let’s move on and show you how to generate a
report.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 18
Create a report for Sales by Category
The Northwind database already contains a number of useful queries
(called views in Alpha Five and in most databases other than Access). We
used one in a grid, Order_Details_Extended.
Let’s use another, Sales by Category, to create a report.
Start by switching to the Control Panel in Alpha Five, and selecting the
Reports tab. Press the New button, press OK in the New Report dialog
to select <SQL Data Source>, and in the Configure DataSource dialog
select the nwa connection string and press Next.
Select Sales by Category from the Tables/Views dropdown and check
*(all columns). You will see a SQL Select statement generated for
you.Alpha Five Web Applications for Access Developers AlphaSoftware.com
19
Press Finish, then OK. Check Use the Report Genie.Alpha Five Web
Applications for Access Developers AlphaSoftware.com 20
Press OK. Call the report Sales by Category. Drop down Groups with
Totals, double-click on CategoryName, Productname and
Productsales as fields, double-click on CategoryName as the only
group, order by Productname, and create a Running total summary for
Productsales. In Options, make titles bold, make fields italic, and put
page numbers, day/ date, and center titles on each page. An initial report
layout layout will be generated. Save it as salesbycat.
Print preview the report using the fifth item on the toolbar. As you’ll see,
this is a good start at a report.Alpha Five Web Applications for Access
Developers AlphaSoftware.com 21
This report could be improved by fixing the formatting of the dollar
amounts for sales and by editing some of the legends from the default
field name, for example changing “Productname” to “Product Name”.
The formatting of dollar amounts is easily done using the docked
Properties pane for each field. The Productsales detail needs to have 2
decimal places, not 4, a $ in its format, and be right-aligned. The
Product_G1 and Product_GG totals need a $ in their formats.
The editing of the detail header can be done right on the report design.
The editing of the running totals can be done most conveniently by right-
clicking on PRODUCT_T1 and PRODUCT_TG, bringing up their full
properties dialogs, and editing their field expressions.
Now we have a fully acceptable report.Alpha Five Web Applications for
Access Developers AlphaSoftware.com 22
You can print this report if you like. You can also run this report from a
web page and display it online, as we’ll see in the next section.
If you’d like to try building an Alpha Five report against your own Access
database, this would be a good time to do it.
Create a Tabbed User Interface for the grid and report
The Tabbed User Interface (UI) builder is a quick way to create the overall
navigation user interface of an application. It can tie together your
disparate Alpha Five components, A5W pages, HTML pages, external URI
pages, reports, and PDF documents into a unified application where
buttons bring up their associated elements in tabs. You can use tabs,
accordions, frames, and containers to organize your buttons.
Let’s quickly create a Tabbed User Interface for the grids and report we’ve
already saved. In your Web control panel click the New button. In the
New File dialog, pick the Web Component icon. Press Next and pick
the Tabbed UI Builder icon. Press OK and you will see the Tabbed UI
Builder Overview.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 23
Switch to the Tabbed UI Controls section and look at the three
accordions Tabbed UI Buttons, Containers, and Other Controls. In
the Tabbed UI Buttons accordion, click on Grid Component and add
your Cust1 grid. Then click on Report and add your salesbycat
report.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 24
Save your Tabbed UI as TabUI1. Now turn on the Alpha Five Application
Server (click the red button on the Alpha Five toolbar and watch it turn
green) and then switch to the Live Preview tab of the TabUI1 designer.
Click on the Cust1 button and your grid will open in the first tab.
If you press the salesbycat button, most likely a second tab will open, a
“Working…” message will display inside the tab, and an Adobe Reader
window will open separately, containing your report. Exactly how this
works depends on your computer’s configuration.
It is worthwhile clicking on one or more of the browser buttons at the
bottom of the Live Preview pane to see your Tabbed UI previewed in one
or more web browsers.
If you created grids and/or reports for your own Access database, this
would be a good time to build a Tabbed UI for them.Alpha Five Web
Applications for Access Developers AlphaSoftware.com 25
Create a Page Layout with accordions for the grid and report
A Page Layout component is very similar to a Tabbed User Interface. Both
can tie together your disparate Alpha Five components, A5W pages, HTML
pages, external URI pages, reports, and PDF documents into a unified
application. Both let you use tabs, accordions, frames, and containers to
organize content.
The big difference between the two is that the Tabbed UI must be the
master interface for an A5W page. A Page Layout is an ordinary Alpha Five
component, so it can be contained in a tab of a Tabbed UI; it can also be
placed on an A5W page.
That isn’t to say that you can’t have more than one Tabbed User Interface
in an application. You can use more than one Tabbed UI by putting them
on different pages. You can tie those pages together into a larger web
application in a number of different ways. You an even nest a page
containing a Tabbed User Interface in a tab of another Tabbed User
Interface – but it’ll look best if one has buttons on the left and the other
has buttons on the right.
Let’s create a Page Layout. Start by creating a new Page Layout Builder
web component. The layout of the builder will look familiar from the
Tabbed UI Builder. Note in the description that the content on a page can
be contained in tab, accordion, frame, and container controls.
For simplicity, let’s start by putting two simple grids, Emp1 and
Ord_det_ext1, in accordions. You create an Accordion control by creating
a Tab Control and switching it to an Accordion. You separate the
Accordions with Tab Panes.Alpha Five Web Applications for Access
Developers AlphaSoftware.com 26
Preview this and you’ll initially see just the unopened Accordion controls.
If you open one Accordion, you’ll see the grid inside. If you open the other
Accordion, the first will close. There will be a short delay as each
Accordion is opened for the first time, but switching back and forth takes
hardly any time at all.
Save this page layout as PL1. See what happens if you set one pane to
open by default, and if you allow multiple panes to be open. Try different
layouts, using Tabs, Frames, and Containers. Experiment with having
grids open when a button is pressed in a Frame or Container instead of
opening automatically. Save any of these that you like under different
names. Also try including multiple Page Layouts in a single Tabbed
UI.Alpha Five Web Applications for Access Developers AlphaSoftware.com 27
This would be a good time to create some page layouts for your own
Access database.
Run the Flying Start Genie
I promised earlier that we’d learn a shortcut for building grids against
tables and views. That shortcut is Alpha Five’s Flying Start Genie. If you
are using a trial version of Alpha Five, the Flying Start Genie will be
enabled by default; otherwise, you will need to purchase the Flying Start
Genie Feature Pack to do this exercise yourself.
From the Web Projects Control Panel, create a new Flying Start Genie:
Connect to the Northwind database through your nwa connection:Alpha
Five Web Applications for Access Developers AlphaSoftware.com 28
For this exercise, select all the tables in the database, which is most easily
done by using the filter to suppress the display of views, and then
pressing the >> icon.
Go to the Finish tab, and click Finish. Save the settings if you wish. After
some delay, a Tabbed UI will display in your default browser with all your
tables in tabs. Alpha Five Web Applications for Access Developers
AlphaSoftware.com 29
Each grid will use the default global settings for the Flying Start Genie,
since we did not change the global settings or override them for any of
the tables. The Global Properties pane, which we skipped, shows the
options. By default, each grid shows the first five fields, the initially hidden
search part works on the same five fields, and the detail part shows all
fields of types that can be automatically generated in a modal popup
window.
If you look at the Products tab, you’ll see that the image field in this table
has not been displayed. (It is an OLE BMP image, if you want to add it
yourself.)Alpha Five Web Applications for Access Developers
AlphaSoftware.com 30
Each of the generated grids can be duplicated and edited to your heart’s
content. You’ve already seen how to create row expanders and linked
grids, but there are many other options available to you.
Publish your work locally
We have been viewing our work in Working Preview and Live Preview
modes, but we have not published anything we’ve created so that others
can see it. When we did a Live Preview, we had to turn on the Alpha Five
Application Server; the Live Preview mode automatically published to a
special Live Preview folder on the server, and you were able to view it
from a browser on your development computer as well as from your Alpha
Five development environment.
Even if you don’t have an Application Server license, other people can
view your work – but only for 30 minutes at a time. They can see your Live
Preview directory, but you should also Alpha Five Web Applications for
Access Developers AlphaSoftware.com 31
learn how to publish your whole web application.
From your Web Projects Control Panel, press the Publish toolbar
button.
Now press the Edit icon to the right of the profile dropdown.Alpha Five
Web Applications for Access Developers AlphaSoftware.com 32
Change the Target Folder to <Default>. As described in the micro-help
at the bottom of the screen, <Default> causes the project to be
published to a folder named based on the current database and project, in
our case Northwind/Default. Press OK.
In the Publish Web Project dialog, check Publish Database Library so
that we can view our report, check Launch browser after files are
published, and select TabbedUI_TabUI1. a5w from the pages to show.
Press Publish. If you are asked to publish Web Security Users and
Groups Data, say No. If you are asked to create c:\ A5Webroot\
Northwind\ Default, say Yes.
After some activity you should see the Tabbed User Interface we built
earlier appear in your default web browser. On my machine, the URL of
this page is http://localhost:8081/
Northwind/Default/TabbedUI_TabUI1.a5w. On your machine, the port
is most likely 80, which is the default and will not be displayed. You
should be able be view the page from other computers on your LAN for 30
minutes. If your computer is at IP address 192.168.1.10, and the port is
80, then the URL of this page will be
http://192.168.1.10/Northwind/Default/TabbedUI_ TabUI1.a5w.
Why didn’t we see all our components listed? It is because, so far at least,
the only saved A5W pages we have created were automatically generated
by the Tabbed UI Builder.Alpha Five Web Applications for Access
Developers AlphaSoftware.com 33
Why were we able to preview components without creating A5W pages?
When Alpha Five does a Live Preview for a component, it automatically
generates a temporary A5W page on which to display the component.
When it does a Working Preview for a component, it automatically
generates a temporary desktop dialog on which to display the component.
Create Additional A5W Pages
If you want to generate more A5W pages, it is as easy as going to the
A5W Pages section of the Web Projects Control Panel, pressing New,
creating a Blank Page or a Page from Layout Template, saving the
page with a name, adding text, and inserting components in the
appropriate places. You may also press Save Page when editing a web
component to create a new A5W page that contains that component;
when the page opens in the HTML editor after saving, you can add
whatever text and HTML layout that you like.
Add Web Security
While we are not going to demonstrate the Alpha Five Web Security
system in this paper, you should know that it exists and what it can do.
The Web Security Framework easily adds a sophisticated security system
to any web application running on the Alpha Five Application Server. The
security system is integrated into the server operation. When the security
framework is turned on, the server automatically checks every requested
page or file for proper security clearance from information saved in
memory. The server checks the page or file permission and will return the
requested file if it is permitted within the security framework for the
project containing the file. If the page or file is not allowed, the server
automatically checks the security configuration to determine the proper
response. This process is repeated for every page and file request,
including images, CSS style sheets, and JavaScript files.
If a field on a component is not available to the user, the Application
Server will remove it from the component on the page returned to the
user. If a menu entry is not available to the user, its link will be disabled.
This is discussed at http://wiki.alphasoftware.com/Web+Appli
cation+Security+Framework. Alpha Five Web Applications for Access
Developers AlphaSoftware.com 34
What’s different about the Web?
We’ve covered quite a lot of things that you can do with an Access
database from Alpha Five. Now we’re going to explain why you might
want to upsize your Access database for Web use, and how to go about it.
There are several considerations to bear in mind when you are moving an
Access desktop database to the Web. First of all, a Web application can
potentially have a very large number of total users, and a moderately
large number of simultaneous users. This means that record locking and
overall scalability are very important for Web applications, even more so
than for desktop LAN applications.
Second, a Web application incurs a delay every time there is a round trip
between the browser and the Web server. This means that performance
can be improved by minimizing the amount of page refresh using Ajax
techniques, and that user frustration can be mitigated by displaying
progress indicators for operations that can take more than a second. You
have already seen that in action with Alpha Five’s Ajax Grids and Tabbed
UI.
Third, a Web application incurs a delay when executing database queries
and downloading the result sets. This means that techniques such as lazy
loading, data pre-fetch, data paging and data caching can make a big
difference in the performance of the application. This also reinforces the
need to display progress indicators.
You may have heard of people using Access databases directly from Web
applications. We don’t recommend this! The primary reason is that Access
databases don’t support high numbers of simultaneous users or tables
with large numbers of rows very gracefully. As you’ve seen, it can be done
from Alpha Five Web applications, at least for small number of users. (We
don’t recommend using Alpha’s native DBF format database for Web
applications, either, primarily for scalability reasons.)
For web use, we recommend a SQL database that’s designed to be a
server. Access is a SQL database, but it is not designed to be a server.
Alpha Five supports many SQL databases that are designed as servers,
including Caché, DB2, Microsoft SQL Server, MySQL, Oracle,
PostgreSQL, Sybase SQL Anywhere, and Sybase SQL Server.
Microsoft SQL Server is the database most frequently offered by hosting
providers on Windows-based Web server accounts.
Other SQL databases can work just as well. If you are on a budget, hosting
your own database, and don’t need paid database support, consider
Microsoft SQL Server Express Edition, MySQL Community Edition, or
PostgreSQL (either the PostgreSQL Core distribution or Postgres Plus
Standard Server), all of which are free.Alpha Five Web Applications for
Access Developers AlphaSoftware.com 35
How to Upsize your Access Database to a Scalable SQL
Database
Check your database schema in Access
Before you go to the work of moving the database from Access, you
should review the schema. In Access 2007 or later, you can see a
database diagram by selecting Relationships from the Database Tools
ribbon:
You can view the details for any table on the diagram by right-clicking on
the table and selecting Table Design:Alpha Five Web Applications for
Access Developers AlphaSoftware.com 36
What you’re trying to determine at this point is whether the database
schema will make sense for the Web application. There may be tables that
you don’t want to import at all: it would be helpful to know that before you
go to the effort of importing them. There may be missing relationships, or
badly normalized tables, or missing primary keys. One Access tool you
can use at this point is the Analyze Table wizard on the Database Tools
ribbon, which will detect some common problems.
If there are problems, you have two basic choices about fixing the
schema: get it right in Access now, or get it right in the SQL database
later, with the help of Alpha Five and any other tools you have for the SQL
database. You can also combine the two. If you attempt to fix the schema
in Access, make sure that you preserve a copy of your original Access
database somewhere safe. We don’t recommend fixing everything in
Access, but you should probably fix any serious normalization problems if
you can, and make sure that the data you migrate has relational integrity.
It’s very important for SQL databases to be properly normalized; to have
unique primary keys for all tables; to have foreign key constraints for all
relationships; and to have indexes on all fields used as foreign keys. If
none of this makes sense, you may want to refer to the Johansen Alpha
Five Web Applications for Access Developers AlphaSoftware.com 37
book listed in the For more information section of this paper for advice on
database design.
If you determine in Step 0 that you need to start over with a better
database design, then Step 1 outlined here will not apply. Instead, you’ll
want to design the new schema, and then import data selectively from the
Access database tables to your new SQL database design. Once this is
complete, you can proceed with Step 2.
Migrate your Access database to your SQL database
Before you can start working with Alpha to build a Web application, you
need to import your database schema and your data to the database
engine you’re planning to use from the Web. We’re targeting Microsoft
SQL Server 2008 for this example. We’ll start by discussing the generic
process, which will also work for other SQL databases.
Import and Export using Alpha Five
For purposes of this example, we’re using the venerable Access 2003
version of the Northwind sample database that ships with Alpha Five.
Start Alpha Five, and from the Select Database dialog’s Database &
Tasks tab pick Create a database from imported data. In the drop-
down box for Access, navigate to the northwind.mdb file that we copied
earlier.
Click the OK button, and then select a location and name for your new
Alpha database. These choices are relatively unimportant; we’ll throw
away the Alpha database once we’ve exported it to SQL Server.Alpha Five
Web Applications for Access Developers AlphaSoftware.com 38
Select all the tables to import, and none of the other assets:
When the import operation is complete, you’ll see a status screen:Alpha
Five Web Applications for Access Developers AlphaSoftware.com 39
This database import had no errors. If you encounter an error, you can go
back to the Access database and fix the problem, delete the partially
imported Alpha database, and try the import again. If you don’t
understand the error message, you might want to ask about it on the
Alpha Forums. When you’re done, you’ll see your imported tables on the
Tables/Sets tab of the Alpha Five control panel:
You can view the imported data in the tables using Alpha Five’s default
browse:Alpha Five Web Applications for Access Developers
AlphaSoftware.com 40
Now, we can export the tables and data to SQL Server:
At this point, we’re defining the SQL database connection and the tables
to export. We’ll be connecting to the SQL database via AlphaDAO:Alpha
Five Web Applications for Access Developers AlphaSoftware.com 41
If your SQL database isn’t already running, start it now. You’ll have to drill
down a few levels to get to the Create SQL Connection String dialog,
where you can select the correct type of database, select the actual
server, select or create the database, and test the connection:
It’s useful at this point to save the connection string from the Connection
String dialog. We used the name nwtest.Alpha Five Web Applications for
Access Developers AlphaSoftware.com 42
With that done, you can open the Alpha database and the target database
simultaneously in the AlphaDAO Export Genie, and select all the tables for
export:
When you close the Genie, you’ll have the opportunity to save the export
operation configuration: we called it nwtest:Alpha Five Web Applications
for Access Developers AlphaSoftware.com 43
Now we can run the export operation, and see the results:
Using the Alpha Five SQL Explorer, we can now view the tables in the SQL
database through the nwtest connection:Alpha Five Web Applications for
Access Developers AlphaSoftware.com 44
From the context menu that pops up on a right mouse click, we can
choose to show the data in the SQL table:
That data, thankfully, looks just like it did in the original Access database
and the intermediate Alpha database:Alpha Five Web Applications for
Access Developers AlphaSoftware.com 45
This is a success as far as it has gone: Alpha Five Web Applications for
Access Developers AlphaSoftware.com 46
What’s wrong with this SQL Server Management Studio database
diagram? The tables are present in SQL Server, and the rows, but there
are no primary keys, no foreign keys, no relations, and no indexes. If you
know what you’re doing, it’s a matter of a few minutes to add all of these
from the diagram view. We also haven’t migrated the Access queries to
SQL Server views; that is a straightforward copy and paste operation if
you know how to look at the query definitions in Access and define them
in Microsoft SQL Server Management Studio or Microsoft Visual Studio.
Access-to-SQL Server specific migration
The main advantage of the data migration method that we just
demonstrated is that it will work with any SQL database supported by
Alpha Five, not just Microsoft SQL Server. However, there are two
methods available from Microsoft that may capture more of the database
assets for the specific case of an Access database moving to SQL Server:
the Access SQL Server upsizing wizard and SSMA for Access.
The Access SQL Server upsizing wizard
We’ll walk through the Access SQL Server upsizing wizard very briefly. In
Access 2007, open the Northwind 2007 sample, and go to the Database
Tools ribbon. In the Move Data group, click on SQL Server. The upsizing
wizard will open: accept the default option, Create new database, and
click on Next.
The next screen is where it may start to get hairy. The SQL Server
instance you use must have SQL Server authentication mode enabled,
and you must have a login that has CREATE DATABASE privilege. If you try
to use an instance of SQL Server 2008, once you log in successfully you
may get the baffling error message:
This was a bug in early versions Access 2007, still present as of 12/2008.
It has been fixed in later versions, including the late Access 2007 service
packs.
If you use an instance of a supported version SQL Server and have the
correct privileges, it works fairly well, and you wind up with a database
that has all the tables, data, relations, primary keys, and indexes:Alpha
Five Web Applications for Access Developers AlphaSoftware.com 47
You don’t want to change the Access application:
As you can see in this diagram, the SQL Server database can be ready to
go immediately after the Upsizing Wizard completes:Alpha Five Web
Applications for Access Developers AlphaSoftware.com 48
SQL Server Migration Assistant for Access (SSMA for Access)
The SQL Server team at Microsoft also produces an upsizing wizard of its
own, called SQL Server Migration Assistant for Access (SSMA for
Access). There are multiple versions of SSMA listed at
http://www.microsoft.com/sqlserver/2005/en/us/migration-
access.aspx. Since this page includes copious instructions, readmes,
FAQs, white papers, and case studies, we won’t belabor the process here.
It’s certainly worth trying, assuming that your Access database is in good
shape.

Using your SQL Database from Alpha Five


Using your SQL Database from Alpha Five is almost exactly like using your
Access database from Alpha Five. The only difference is the connection
string: instead of having a connection string for an Access file, you have a
connection string for a SQL Server.
On the machine I’m currently using, mhPhenom, I have a SQL Server
Express instance that contains a copy of Northwind. (I think I created this
copy from Microsoft’s instnwnd.sql script, which you can download from
Microsoft.com here.) When I open mhPhenom\SqlExpress in SQL Server
Management Studio using Windows Authentication, I can see all the tables
and views. When I create a database diagram for Northwind, I see the
correct relations set up between the tables. When I look at the Indexes for
a table, I see all the correct fields being indexed.Alpha Five Web
Applications for Access Developers AlphaSoftware.com 49
Armed with that knowledge, I can create a connection string for Northwind
on SQL Server in my Northwind Alpha Five project. After bringing the
Control Panel to the foreground, I select the Tools|External Databases|
AlphaDAO Connection Strings menu item. In the AlphaDAO
Connections dialog, I add a new connection.
After testing the connection successfully, I refresh the database
dropdowns and select Northwind. I save this as nw sql. Note that your
connection string will be slightly different depending on the location and
instance name of your database.Alpha Five Web Applications for Access
Developers AlphaSoftware.com 50
I can use this to create new grids and reports, and I can switch connection
strings in my existing tables and reports without changing the rest if the
artifact, but even more conveniently I can use this information to create a
new publication target for my Alpha Five project that automatically
substitutes the contents of this connection string for the normal contents
of the nwa connection string that we originally used for all our
components and reports.
From the Web Projects Control Panel press the Publish button and
open the Publish Web Project dialog. Open the Web Project Profiles
dialog using the edit icon.
Now press the Add New Profile button to bring up the New Publishing
Profile genie. Right now we’re going to publish locally, but this process is
very similar to what you’d do to publish to your LAN or to an ISP. I am
calling my new Application Folder NWSS.Alpha Five Web Applications for
Access Developers AlphaSoftware.com 51
We need to pick a default page (for convenience) and publish our library
files (so that the report will work).Alpha Five Web Applications for Access
Developers AlphaSoftware.com 52
Save the profile as nwss. Here’s the magic step: examine the nw sql
connection string in the Local Webroot profile:Alpha Five Web Applications
for Access Developers AlphaSoftware.com 53
Now edit the nwa string in the nwss profile to be the same SQL
connection string.Alpha Five Web Applications for Access Developers
AlphaSoftware.com 54
Save that, start your Application Server, and publish the nwss profile. If
all goes well you will see your Tabbed UI with grids and reports working
against the SQL Server Northwind database in your default browser.Alpha
Five Web Applications for Access Developers AlphaSoftware.com 55
If you view the other tabbed UI on your site, with the Flying Start Genie
results, you’ll see that all of those grids work, too.Alpha Five Web
Applications for Access Developers AlphaSoftware.com 56
If you’d like to verify that the NWSS site is actually working against the
SQL Server connection string, view the C:\A5Webroot\NWSS\
a5_application.a5i file in a text editor. Under AlphaDAO Connection
Strings you will see that the values for nw sql|Encrypted and nwa|
Encrypted are identical.

Summary
In this paper we have demonstrated a few of the web components and
reports that you can build easily against an Access database with Alpha
Five V10.5 or later. We have learned how to upsize an Access database to
SQL Server or another scalable SQL database, and we have seen how
easy it is to make the same components built against an Access database
work against an upsized SQL Server database with the same schema.
What’s keeping you from giving the same treatment to your own Access
data?

For more information


Web sites
Alpha Software Web site, http://www.alphasoftware.com
Alpha Five and Access Web site,
http://www.alphasoftware.com/alphafive-vs-msaccess. asp
Alpha Software blog, http://blog.alphasoftware.com/
We have published several interviews with former Access developers
who have migrated to Alpha Five, as well as articles covering many of
the issues Access developers are facing today with the release of
Access 2010. There is also a comprehensive comparison grid that
shows you how Access stacks up against Alpha Five and other popular
database development platforms. You can continue your reading and
research on our blog at the following links:
• http://blog.alphasoftware.com/search/label/Access

http://blog.alphasoftware.com/search/label/Micros
oft%20Access

http://blog.alphasoftware.com/search/label/Compa
rison
• http://blog.alphasoftware.com/2010/01/comparing-
alpha-five-version-10-to.html
Alpha Software forums,
http://msgboard.alphasoftware.com/alphaforum/
Alpha Five online documentation wiki, http://wiki.alphasoftware.com
Books and Training videos
https://www.alphasoftware.com/shop/v10/booksVideos.asp
57

In This Whitepaper
Working with an Access Database from Alpha
Five......................................................................1
Install Alpha
Five..............................................................................................................
.............................1
Connect to the Northwind Access
Sample........................................................................................2
Create a grid against the Customers
table........................................................................................5
Create a row expander drilldown for
Orders.................................................................................10
Create a linked content area for Order Details and
Employees............................................13
Create a report for Sales by
Category................................................................................................18
Create a Tabbed User Interface for the grid and
report............................................................22
Create a Page Layout with accordions for the grid and
report.............................................25
Run the Flying Start
Genie...........................................................................................................
...........27
Publish your work
locally..........................................................................................................
...............30
Create Additional A5W
Pages...........................................................................................................
.....33
Add Web
Security.......................................................................................................
.................................33
How to Upsize your Access Database to a Scalable SQL
Database......................................35
Check your database schema in
Access............................................................................................35
Migrate your Access database to your SQL
database................................................................37
Import and Export using Alpha
Five..................................................................................................37
Access-to-SQL Server specific
migration..........................................................................................46
Using your SQL Database from Alpha
Five.....................................................................................48
Summary.....................................................................................................
.....................................................56
For more
information.................................................................................................
...............................56
Web
sites.............................................................................................................
.............................................56
Books and Training
videos..........................................................................................................
............56
Alpha Five Web Applications for Access Developers
AlphaSoftware.com

You might also like