Hi Peeps,

I am new to this forum, I am trying to create a weblog to allow users who are registered in a database I create in Access to create a blog entry which will be displayed on the screen to every one. I have created the database i Access and can manage some how using Dreamweaver to display contents of the database BUT THE QUESTION NOW IS, HOW DO I USE A FORM TO ENTER INFORMATION INTO THE DATABASE PLEASE! HELP ME AM DESPRATE.THANKS A MILLION... :-| :-| :?:

13 Years
Discussion Span
Last Post by zippee

THere is a bult-in form creation wizard in Access. This will obviously limit data entry and retreival to one computer or possibly multiple clients on a LAN.

If you need remote Web Access as you imply, then you'll need something more complicated. Generally, Access is not good online as it's slow and cannot handle more than one request simultaneously. If you really want it, you can use it, but you should be aware that there are a raft of free database servers that are significantly faster online.


I have been using asp and Access to create a forum (see www.basket2go.net/forum.asp). Scripts to add data to DB is listed below. Hope it may help:

' Get user name
ForumUser = Request.Form("user")
' re-structure the message in useable form
mssg = Trim(Request.Form("mssg"))
mssg = Server.HTMLEncode(mssg)
mssg = Server.URLEncode(mssg)
mssg = Replace(mssg, Chr(13), "<br>")
mssg = Replace(mssg, "'", "&acute;")
PostMssg = "<p class=bbody><b>" & ForumUser & "</b> <span class=stext>Posted on " & Now() & " GMT</span></p>"
PostMssg = PostMssg & "<p class=body>" & mssg & "</p><hr color=#EFEFEF>"

' check action
Select Case Request.Form("action")
Case "newpost"
' get the next PostID
Dim nDB, nRS, nSTR, nSQL
Set nDB = Server.CreateObject("ADODB.Connection")
set nRS = Server.CreateObject("ADODB.Recordset")
nSTR = "Driver={Microsoft Access Driver (*.mdb)};" & "dbq="&server.MapPath("db/dbForum.mdb") & ";"
nDB.Open nSTR
nSQL = "SELECT * FROM tblPost Order By PostID ASC"
SET nRS = nDB.Execute(nSQL)
While Not nRS.EOF
PostID = nRS("PostID")
PostID = CInt(PostID) + 1
PostTitle = Trim(Request.Form("title"))
' open database and add new record
nSQL = "Insert Into tblPost (PostID, PostDate, PostTitle, PostMssg)" &_
" Values ('"&PostID&"', '"&Now()&"', '"&PostTitle&"', '"&PostMssg&"')"
nDB.Execute nSQL
' Close and destroy all objects
Set nRS = Nothing
Set nDB = Nothing
' send user back to the forum he/she come from
Response.redirect "forum.asp"
Case "response"
' add response to existing forum
' open database to retrive existing message and number of replies
Dim rDB, rRS, rSTR, rSQL
' Open database for shopping cart
Set rDB = Server.CreateObject("ADODB.Connection")
set rRS = Server.CreateObject("ADODB.Recordset")
rSTR = "Driver={Microsoft Access Driver (*.mdb)};" & "dbq="&server.MapPath("db/dbForum.mdb") & ";"
rDB.Open rSTR
rSQL = "SELECT * FROM tblPost WHERE PostID = '"&Request.Form("id")&"'"
SET rRS = rDB.Execute(rSQL)
While Not rRS.EOF
PostReply = CInt(rRS("PostReply")) + 1
PostMssg = rRS("PostMssg") & PostMssg
' Close and destroy all objects
Set rRS = Nothing
' update database with new data
rSQL = "Update tblPost SET PostDate = '"&Now()&"', PostMssg = '"&PostMssg&"', " &_
" PostReply = '"&PostReply&"' WHERE PostID = '"&Request.Form("id")&"'"
rDB.Execute rSQL
' Clean up
Set rDB = Nothing
' send user back to the forum he/she come from
Response.redirect "forum_display.asp?id=" & Request.Form("id")
Case Else
' if not both cases, i.e. an error
Response.redirect "forum.asp"
End Select

Good luck.

Edited by pyTony: fixed formating

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.