If you can't explain it simply,
you don't understand it well enough.
-Albert Einstein
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  

Create an Online Database
Using MS Access and ASP

Take your Web site to the next level... build a database, connect it to your Web site, and display interactive pages to your users! Allow users to view, edit, delete, and add information to your Web site, and more.

If you want to learn how to build an online database that can be used on the Web, then this seminar is for you. We will build tables in a Microsoft Access Database, and then use Active Server Pages to construct a live, dynamic web site.

The example that we will use in class is a full-featured test-taking web site, where teachers can log on and create quizes and tests for their students consisting of multiple-choice answers. The students can then log on and take the tests and be graded.


Seminars - Web Database
Description: Seminar for creating Web-based databases using
Microsoft Access and Active Server Pages (ASP).
Versions: We will use Access XP, FrontPage XP, and ASP
Pre-Requisites: HTML 101 strongly recommended
ASP 101 recommended
Access 101 - 201 helpful
Visual Basic 101 helpful but optional
FrontPage 101 - 102 helpful
Running Time: Over Six (6) Hours
Cost: $129
Notes: You do NOT need to use Microsoft Access for your database, and you do NOT need to use FrontPage as your web editor. You may use any database program and web page editor of your choice. The main focus of this seminar is how to write ASP code to access your data. This seminar will NOT cover the use of PHP or MySQL.
See below for details.

We actually developed this seminar while recording the development of our very own 599CD Skills Test System - that you can log on to right now and take a test.


While you might not be developing this kind of a database for your web site, we will teach you all of the fundamentals involved with setting up your web-based database. The steps covered in this seminar include:

  • Creating your Access database tables
  • Uploading your database to your Web server
  • Creating a System Data Source Name (DSN)
  • Testing your database connection
  • Displaying database records in your web pages using ASP
  • Looping through sets of records
  • Passing variables between pages using a QueryString
  • Storing user-specific data in Session Variables
  • Gathering user input using HTML forms
  • Using the ASP Include Page directive for reusable code
  • Adding records to your database tables
  • Editing records
  • Deleting records
  • Formatting your pages with HTML tables for style
  • Sending automatic Email from your Web server

As you can see, this seminar covers quite a lot of information. I will literally take you through the entire creation of a web-based database from conception to completion. You won't miss any steps as I start from scratch, build the Access database, upload it to the Web server, set up the connection, and start building pages. > Richard Rost, Instructor

NOTE: The free introductory lesson (see below) will show you all of the topics covered in this class, and discuss what you need to get started.

So no matter what kind of online database you're planning to build, this seminar will give you all of the fundamentals and information you need to get started.

You can then take this information to build everything from a customer management system to an online shopping cart... all of the fundamental concepts of working with online databases are covered in this seminar.


All of the basics, from setting up your Access database to adding, editing, and deleting records, to passing and storing variables between your pages... are all covered.

We will begin by setting up our database using Microsoft Access. Now, you do NOT need to use Access for your database. You can use any database program that you like, as long as it conforms to ODBC standards. If you want to use SQL Server or even Oracle as your database server, that's fine too. I personally prefer using Access for low- to mid-volume databases, and it's the easiest to set up.

Our database will consist of just a few simple tables... one to store the names of the tests we want to give the students, another to store the questions, and a third to store all of the answers (multiple choice). If you've taken any of my Access courses, you'll find this part a piece of cake. I list Access 101 - 201 as a pre-requisite only because we cover table relationships in Access 201. Really, you'll be just fine even with Access 101 under your belt.


Next, I will discuss how to upload your database to your web server. Now, for my personal setup, I use a Windows 2000 Server, and I use pcAnywhere to connect to my server and upload the database. However, your setup may be different, and that's OK (see below for details).

After we learn how to display records from our database on the screen, we'll learn how to loop through records in a table. We'll display all of the records in our Test table to show a list of all of the tests available. This might sound easy, but it's actually quite an accomplishment for ASP code. Remember, there's no graphical editor to do this with. This is real programming!


Next, we'll learn how to pass information between web pages using the QueryString. This allows us to send data from one page to another using the address bar URL.


Next, we'll go through and create pages to display all of the questions and answers in our database. Click on a test to see all of that test's questions. Click on a question to see all of the possible answers.


Next, we'll learn how to store information in the memory of the web server itself. These are called Session Variables and they are handy for remembering temporary information... such as the current user's name, or what test he's viewing. Data that doesn't necessarily have to be stored can be remember during this user's Web "Session."


Next, we'll learn how to gather information from the user in a Web Form. We will be able to add tests, add questions, add answers, and get information like a username and password to log on to the web site.


Now that we know how to get user input, we can add records to our database. We'll design forms to add tests, questions, and answers.


Once we know how to add records, we'll of course have to be able to edit and delete those records. We'll create pages to edit and delete test names, questions, and answers.


We'll even learn a little bit of JavaScript which is a browser-based programming language. This will allow us to ask the user if he's sure he wants to delete the record.


As a side note, we'll of course talk about the security of your web pages... making sure someone can't just hack into one of your ASP pages and start editing your data. Go ahead and try. Our online Skills Test System is as secure as any page can be (well, unless you guess my password).

So far everything we've built is what the teacher (admin) sees... to add, edit, and delete questions and answers. Next, we need to create the student's interface. So we'll make a logon screen for students...


Side note: yes, while I do take a little bit of time to show you some formatting in class (tables, colors, etc.) I don't want to waste a whole lot of time on that - so you'll notice that my pages aren't exactly pretty at this point. However, if you really want to learn how to build attractive web pages, I recommend my Frontpage series of classes. Here, I'm just focusing on making the HTML functional, and the ASP code work with the database.

We will next create the entire test taking engine... allowing the user to pick a test, and then be quizzed on each of the questions for that test.


The student will get progress shown with each question, and can see what the correct answer is if he misses it.


If the user answers at least 80% of the questions correctly he will be able to print out a Certificate of Completion.


Finally, it's always nice to know when a user does something on your web site. We'll teach you how to send email using your web server. This way I am notified any time one of my students completes a test... you can also use this to contact the user directly from the web server. Being able to send mail is a very handy feature.

Now, if you're not sure as to whether or not you can get your web site to work with ASP and an Access database, we have provided the first couple lessons of this seminar for you to review free of charge before you buy the complete package.

If you've taken my ASP 101 course and have been able to use the lessons in that tutorial, then your server is fine as far as ASP is concerned.

  • If you have your web site hosted for you by an Internet Service Provider (ISP), and they're supposed to give you database access and ASP support, then setting up the database is usually a service they will provide for you. They will at least be able to give you instructions how to set it up on their server.

The only time you should actually have to set the database up yourself is if you run your own web SERVER at your own facility. Then you might have to go in and actually configure the DSN yourself. Again, I will show you how to do this step-by-step with Windows 2000 Server (almost the same for Windows 2003 Server). But if you don't have your own server, your ISP will generally perform this service for you.

As long as you know how to get the database up to your web server, and can figure out setting up a Data Source Name (DSN), you will be able to use this seminar.


Nevertheless, I provide the introduction and first three lessons of this seminar to all students FREE OF CHARGE before you purchase it, so that you can make sure you can get the database up and running on your web site, and test it with ASP code before buying the seminar. The first three lessons cover:

  • Building your Access database tables
  • Configuring the database on your server
  • Displaying test data from your database on a web page

If you can get these three steps working, you're good to go with the rest of the seminar. Again, I'll cover more detail in the seminar itself.

Please view the intro and first three lessons
FREE OF CHARGE to make sure you can
use the lessons in this seminar.

Lesson View
In Browser
0. Introduction
1. Creating Your Access Database
2. Uploading To Your Server
3. Displaying Test Data with ASP

If you don't have your own Windows server (perhaps you're leasing space from a hosting company) you can still set up a web-based Access database if you're using Microsoft FrontPage or Expression Web. I cover that in detail in my Web Data Synch Seminar. Here are two lessons from that seminar that will show you how to do it:

These lessons will teach you how to set
up a web-based database in FrontPage
or Expression Web without server access

Lesson View
In Browser
15. Acquire Data on Web Page
16. Data Collection Page

that this database is NOT for you if you do not have ASP (Active Server Pages) on your server. If you are working with the programming language PHP, then this seminar is NOT for you.

Want a quick test to see if your web site has ASP installed? Here's what you do... open up your web browser and create a blank new page. In the HTML design for the page, just type in the following:

<% response.write Date %>

Now save your page and load it up in your Web browser. If you see today's date displayed just like below, then ASP is installed and working properly.


I have not tested the seminar code with the Linux operating system or the MySQL database, although if you have 100% support for ASP code, then you should be able to get it working - but I make no guarantees for support.

To use the lessons in this seminar, I recommend you run a Microsoft Windows Server (2000 or 2003) which uses genuine Active Server Pages technology.


So that just about covers it. This is a great seminar. If you have been looking to take a database and put it online so people can access your records, make changes and additions, and collaborate with you, this is the perfect starter kit.

This seminar is long (just over six hours), but it's broken up into 26 easily manageable lessons of 10 to 20 minutes each. You can sit down, watch a lesson, review the material, test out the code yourself... and do a little bit each day. It's long, but it's comprehensive - you won't miss a single step as I've recorded everything from start to finish.

You can use this information to create a customer database, a product or inventory web site, an online shopping cart, the list goes on. Once you know how to add, edit, and delete records in a database, the sky's the limit!



Student Interaction: Web Database Seminar

Richard on 1/1/2007:  Take your Web site to the next level... build a database, connect it to your Web site, and display interactive pages to your users! Allow users to view, edit, delete, and add information to your Web site, and more.
Mary Gleeson on 2/1/2008: I would be interested in enrolling in this course seminar. Can it be ordered on CD or online?
Richard Rost on 2/5/2008: When you enroll, you get your choice of having it shipped on CD, watching it online, or downloading the files (which can be burned on a CD if you want). The only difference is the CD adds shipping & handling charges. Order Online
James  on 12/16/2009: Immediate success. Opportunities for this project is keeping me very busy. I was wondering how difficult it would be to put a counter on each test so I can tell which one is most popular. I use this program as "test your knowledge" exercises. I would like the counters to be displayed in the "Admin" user area & not available to the public. Thanks
Richard Rost on 12/20/2009: James, anything is possible. Just add a "times taken" field to the Test table, and then any time the test is accessed (or finished - your choice) then increment that counter. Don't display it for anyone but you.
james delaverson on 12/24/2009: Richard, am a little confused. I know how to make a field. I know how to increment a counter, but I don't understand the relationship between the field and the counter. Do I use "rs.update" like in adding "new test" or is this something different.
Merry Christmas. No hurry for the reply. Thanks.

Richard Rost on 12/25/2009: James, I'm sorry but I don't understand your question. Can you elaborate, please?
james delaverson on 1/1/2010: You advise..create a field in database...then "increment that counter"...doesn't that mean that I have to write in the field in the database? and do I use rs.update to do it?
Richard Rost on 1/3/2010: James, essentially you would add that "TimesTaken" as a field in the Test table. Then, at whatever point you want (when the test is started, finished, etc.) you would increment the counter. That would involve opening a connection to the table and adding 1 to the value in there.
 Benjamin Berks on 5/17/2010: I was able to set my access database to the IIS server on windowsXP pro. To do this I just saved my access file (created in the previous clips), to the location on my computer I wanted the DSN to point to. Then, I selected PROGRAM > CONTROLS. Then, click "Administrative Tools" and the TAB "Data Sources (ODBC).

Next, click tab "System DSN" and ADD button.

Next, scroll thru drivers to "Microsoft Access Driver".

Next, in the field 'Data Source Name', I enter "SkillsTest".

Next, click on the Database "Select.." button. And surf to the location on the computer I have the access file saved and click OK.

Now when the ASP page calls the DSN "SkillsTest" it will connect to this locally saved file thru the IIS server on MicrosoftXP Pro.

Richard on 11/10/2010: IMPORTANT NOTE: If you don't have your own Windows server (perhaps you're leasing space from a hosting company) you can still set up a web-based Access database if you're using Microsoft FrontPage or Expression Web. I cover that in detail in my Web Data Synch Seminar. Here are two lessons from that seminar that will show you how to do it:

- LESSON 15: Acquire Data on a Web Page
- LESSON 16: Data Collection Page

 Brent on 3/27/2011: I contacted my server people and the code you had me upload will not work is what they are telling me: Below is what they wrote me

"This example describes using ASP/ADO to connect to an Access Database.

NOTE: This code requires full trust and will not work on hosting accounts running ASP.Net 2.0/3.0/3.5/4.0.

Dim oConn, oRs
Dim qry, connectstr
Dim db_path
Dim db_dir
db_dir = Server.MapPath("access_db") & "\"
db_path = db_dir & "yourdatabasefile.mdb"
fieldname = "your_field"
tablename = "your_table"

connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename

Set oRS = oConn.Execute(qry)

if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & ""
end if

Set oRs = nothing
Set oConn = nothing


What can I do to get a connection to my server? I have taken your ASP 101 course and it works with all your examples there with the response.write etc.

 Brent on 3/28/2011: I do not use Microsoft Front Page, I use Coffee Cup HTML 2010 for my html editor. My hosting is goDaddy, What GoDaddy is saying is that the code you use in your lesson requires full access, is there a way around this. I can not proceed any further with the lessons since I cant get a basic connection to the database.

Reply from Richard Rost:

I also use GoDaddy for one of my servers. In fact, the 599CD Theater is hosted on a GoDaddy server (amicron2.com). You must have just gotten a tech rep who doesn't know what he's talking about (happens ALL the time to me... and not just with GoDaddy).

Do you have MICROSOFT hosting or their Linux hosting? With Microsoft hosting, FrontPage will automatically set up the READ/WRITE permissions you need for the folder that contains your database. This is one of the reasons I love FrontPage (now Expression Web).

Even without FP, however, you should still be able to use their file manager to go in and set the permissions for your database folder so that the Internet User account (your server) has access to WRITE to the database folder. Without write access, you won't be able to write information to your database file. Can you READ info from the database and display it on your web page?

 Brent on 3/28/2011: Microsoft Hosting, I set permissions on database to 777
I get a 500 internal server error

my dsn name is access_test.dsn and my datbase file is test.mdb, my access_db folders permissions are also set to 777

my file reads as follows:


dim Conn
set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "DSN=access_test"

Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")
Dim SQLStr
rs.Open SQLStr, Conn


response.write "First test Name: " & rs("TestName")

set rs = Nothing
set Conn = Nothing


Reply from Richard Rost:

Try the alternative method on this page:


Go down about half way down the page and watch lessons 15 and 16. It doesn't require a dsn.

 Patrick Hoffmann on 7/25/2012: Hi Richard,
I've heard you say that you are using Frontpage for your web design. I use to use Frontpage 2003 but no longer have the software, so I was wondering what you thought of Expression Web instead of Frontpage for web design work.


Reply from Richard Rost:

Honestly, I'm not too happy with it. I have Expression Web 4 on one computer, and it's got some nice new features, but I still prefer FrontPage 2003. I use FP for the bulk of my design work. EW just seems to clunky and clumsy. Maybe I just need to get used to it... but I've been using it on and off for a year now and still think FP is better. But, what are we going to do? Microsoft has dropped FP, so we best get used to EW, eh?

leroy a d on 2/8/2013: Why isnt "Web Database Seminar
"On The Ordering Page I dont see anything on it just on this page?

Reply from Richard Rost:

I believe it's listed under the ASP courses. I need to double list it under Access too.

gel on 1/8/2015: Hi Rick! just want to ask if printing of reports are also covered here in details...i find your tutorials easy for me to understand..anyway even its outdated i still able to upload and create web pages using classic asp...i knew it will take some time for you to continue the asp lessons.

Reply from Alex Hedley:

You can just print the webpage.

gel on 1/8/2015: Hi Alex,

what i mean is that the form will be the same as vb that it has a button "print" then the print options will show. thanks

Reply from Alex Hedley:

Hi Gel,
I'm not sure of your question.
Which Form? An Access Form or a Form on a webpage?
This course is more about putting the details of the db on the web and viewing it in a browser.
If you want to learn about Reports in an Access db and printing those you'll want another course.

gel on 1/9/2015: form on a web page


Reply from Alex Hedley:

Just style the page using CSS and you can use the print functionality in the browser.
You can add a button to the form

<a href="javascript:window.print()">Click to Print This Page</a>
Or add it to a button, which ever you prefer


Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP