I suggest that you acquire a Front Page Bible and a HTML book from the
library. It explains everything very well and is easy to use. To
create a dynamic HTML webpage that retrieves data from the database as
opposed to a static data access page, you need the following items:
OBDC connection--DSN (go to Start button on your Windows taskbar, to
the Control Panel, ODBC icon. Set up your DSN (datasource) where the
database is located.)
MS-Access Database (2 tables: Accounts,AccessLog....)
2 webpages (login.asp) and (mainpage.html)
Web Browser (Internet Explorer)
Web Editor (front Page, Word, cold fusion, etc..)
Create a login form in MS-Access that has all the necesary fields
(firstName, lastname, address, etc...), In the menu go to FILE, Save
as Dynamic HTML (follow the prompts). Open the saved webpage in a Web
Editor so that you can see the HTML code. See example below for code.
The textboxes on your login form must have the same names, such as
myUserid, mypassword,lastname....These pass the values typed into the
webpage back to through the ODBC connection to the database.The user
gets an error message if nothing matches the database. It goes to the
next page (mainpage.html) that you have created to say thank you it
the match is correct.
How do you set up a webpage where the user must enter a password to access?
You need to create a dynamic login webpage. See the following HTML
code sample. You can cut & paste the important parts such into your
..ASP webpage.
<QUERY NAME="Get_ID" DATASOURCE="Database1">
SELECT Password,LastName
FROM accounts
where Username ='#form.myUserid#'
</QUERY>
<IF Get_ID.Password is '#form.mypassword#'>
<P>
<OUTPUT>Authenticated</OUTPUT>
<P>
<SET Account_ID=#form.myUserid#>
<SET Account_PW=#form.mypassword#>
<SET Account_LN=#Get_ID.LastName#>
<!--- <QUERY NAME="LogAccess" DATASOURCE="Database1">
INSERT INTO AccessLog (LastName,AccessDateTime)
Values ('#Get_ID.LastName#',#Now()#)
</FQUERY> --->
#form.myuserID# -- #form.mypassword# -- #get_id.recordcount#<BR>
<LOCATION URL="mainpage.html"">
<ELSE>
<output>
<HTML>
<HEAD>
<TITLE>Access Error</TITLE>
</HEAD>
<BODY BGCOLOR="white" >
<P><CENTER><IMG SRC="../../gifs/database.gif"
ALIGN=bottom></CENTER></P>
<TABLE CELLPADDING="0" WIDTH="450" CELLSPACING="0" BORDER="0">
<TR ALIGN="left">
<TD VALIGN="MIDDLE" ALIGN="LEFT" WIDTH=450><b>Access Error</B></FONT>
<P>
The User ID or Password that you entered is incorrect. Please try to
<A HREF="index.html">log in</A> again
<P>
<BR>
</p>
</TD>
</TR>
<TR>
<TD align="center">
<P><CENTER>
<HR WIDTH="70%">
<HR WIDTH="70%">
</CENTER>
</TD></TR>
</TABLE>
</BODY>
</HTML>
</output>
</IF>
Good Luck!!!
pjac