Can Access be used on a website?

  • Thread starter Thread starter Dino
  • Start date Start date
D

Dino

I am trying to determine if I can use an Access DB thru
our website to have case managers select from a list of
about 800 topics, have their selections inserted into a
basic email form where it will be submitted to me. Is
this possible? If so, can an average user like myself set
it up?
 
Yes, Access can be used on a site. Whether or not is appropriate for your
site is a whole different question.

Is you data really only a list of 800 items? Could you use a flat text file
instead? What is the Front-end? Is this fo y intranet or the internet?

--
Kevin Hill
President
3NF Consulting

www.3nf-inc.com/NewsGroups.htm
 
Here's an example of an ASP page using JMail and an Access
database to send selected info to an email address. For this
code to work, you need the JMail.dll library (you can download
from my site) and a database named Example.mdb with a table
named tblTopics.

Cheers
Danny Lesandrini
www.amazecreations.com/datafast


<%@ Language=VBScript %>
<% Option Explicit %>

<HTML>
<HEAD>
<TITLE>Access JMail Example
</TITLE>
</HEAD>

<BODY topmargin=20 leftmargin=20>
<FORM method=post action=Example.asp id=frmExample name=frmExample>

<%

Dim sName, sEmail, sTitle, sMsg, sOut, CrLf

CrLf = Chr(13) & Chr(10)

sName = Request.Form("txtName")
sEmail = Request.Form("txtEmail")
sTitle = Request.Form("txtTitle")
sMsg = Request.Form("cboTopic") & CrLf & CrLf & Request.Form("txtMsg")

' If form was posted, then send mail
If Request.Form("cmdSend") <> "" Then
If sEmail <> "" Then
If sName = "" Then sName = "No Name Given"
If sTitle = "" Then sTitle = "No Subject Given"
If sMsg = "" Then sMsg = "No Message Given"
sOut = SendEmailMessage (sName, sEmail, sTitle, sMsg)
End If
End If

Dim sSQL, sPath, sConn, cnnDBS, rsData, sComboBox

Set cnnDBS = server.CreateObject("adodb.connection")
sPath = LCase(Server.MapPath("example.asp"))
sPath = Replace(sPath, "example.asp", "example.mdb")
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & sPath
cnnDBS.Open (sConn)

Set rsData = server.CreateObject("adodb.recordset")
sSQL = "SELECT Topic FROM tblTopics ORDER BY Topic"
Set rsData = cnnDBS.Execute(sSQL)

sComboBox = " <SELECT name=cboTopic id=cboTopic style='WIDTH: 300px'>" & CrLf
sComboBox = sComboBox & " <OPTION></OPTION>" & CrLf
Do Until rsData.EOF
sComboBox = sComboBox & " <OPTION>" & rsData.Fields("Topic") & "</OPTION>" & CrLf
rsData.MoveNext
Loop
sComboBox = sComboBox & " </SELECT>"

%>

<table border=1>
<tr>
<td>Enter Email Recipient Name: </td>
<td><INPUT type="text" id=txtName name=txtName></td>
<td></td>
</tr>

<tr>
<td>Enter Email Recipient Name: </td>
<td><INPUT type="text" id=txtEmail name=txtEmail></td>
<td></td>
</tr>

<tr>
<td>Enter Email Title (subject): </td>
<td><INPUT type="text" id=txtTitle name=txtTitle></td>
<td></td>
</tr>

<tr>
<td>Select a Topic: </td>
<td><%=sComboBox%></td>
<td></td>
</tr>

<tr>
<td>Enter Email Message: </td>
<td><TEXTAREA rows=3 cols=60 id=txtMsg name=txtMsg></TEXTAREA></td>
<td></td>
</tr>

<tr>
<td colspan=3><INPUT type="submit" value="Send" id=cmdSend name=cmdSend></td>
</tr>

<tr>
<td colspan=3><%=sOut%></td>
</tr>



</table>

</FORM>
</BODY>
</HEAD>
</HTML>

<%

Function SendEmailMessage(sRecipName, sRecipEmail, sSubject, sBody)
Dim objJMail, sServer, sUID, sPWD, sErrMsg

' ///////////////////////////////////////////////////////////////////////////////
' To use this component, you must have registered jmail.dll
' JMail requires a pop server, user name and valid password.
sServer = "smtp.YourServer.com"
sUID = "YourUserNameHere"
sPWD = "YourPasswordHere"

' ///////////////////////////////////////////////////////////////////////////////
' To use this component, you must have registered jmail.dll
Set objJMail = CreateOBject( "JMail.Message" )
objJMail.silent = True
objJMail.Logging = True

' ///////////////////////////////////////////////////////////////////////////////
' For simplicity, we've hard-coded the FROM address and name. You can and should
' replace these with your own contact info.
objJMail.From = "(e-mail address removed)"
objJMail.FromName = "JMail Example"

' ///////////////////////////////////////////////////////////////////////////////
' As many recipients may be added as needed/desired. Again, for simplicity we're
' only inserting one here for this example
objJMail.AddRecipient sRecipEmail, sRecipName

' ///////////////////////////////////////////////////////////////////////////////
' Add your subject and body. If your body text has HTML tags, you can set the
' body text to display it using the HTMLBody property. Priority is also an option.
objJMail.Subject = sSubject
objJMail.Body = sBody
'objJMail.HTMLBody = sBody
'objJMail.Priority = iPriority

' ///////////////////////////////////////////////////////////////////////////////
' Provide authentication values and send mail item.
objJMail.MailServerUserName = sUID
objJMail.MailServerPassWord = sPWD
objJMail.Send(sServer)

' ///////////////////////////////////////////////////////////////////////////////
' The log contains any error message. Use it to give feedback to user.
sErrMsg = objJMail.Log
If InStr(1,sErrMsg,"Ok: queued as") > 0 Then sErrMsg = ""

If sErrMsg = "" Then
sErrMsg = "<font color=green>Mail Send was successful.</font>"
Else
sErrMsg = "<font color=red>" & sErrMsg & "</font>"
End If

SendEmailMessage = sErrMsg

End Function
%>
 
Back
Top