Using MS Access to capture data from a web form...

Kris

New Member
Joined
Jan 26, 2003
Messages
14
Hi I just wondered if any one could help me out. Basically my problem is that I want access to capture and store the results of a form on a web page.

For example an input box called "emailaddress" on a web page gets submitted and the email adress inserted into this box will be sent to an access database.

Any help is appreciated, Thanks.

Kris
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Kris,

You could do this using an Active Server Page (ASP) that resides on your web server. It's not the simplest thing in the world to do. Me and my brother did some test stuff on this a while ago and I'll refer to that here.

You need to ensure that the Access database resides on your web server. In the page that the client will see you'll need to include appropriate FORM tags so that the browser knows that once the end-user has clicked Submit, then it needs to carry out some action (in this case, we'll want to instruct the web server to open the ASP page. Take a look at the HTML of this page - it's a bit messy because it's just an experiment but you should get the idea.

http://www.danielklann.com/test/test_asp.asp

When you click Get Price on this page the Action attribute of the FORM tag tells the Web Server to open the file GetPrice.asp - this file resides on the web server and cannot be viewed by the client - here is the coding for that page:-

Rich (BB code):
<html>

<script language=VBScript runat=Server>

response.write "<html>"
response.write "<body>"
response.write "<FONT face=arial>"
response.write "<H2>Thanks for your request Ben.</h2>"
response.write "
Here is the cost for your chosen computer:-"
response.write "
</br>"


set adocn=server.createobject("ADODB.Connection")
adocn.provider="Microsoft.Jet.Oledb.4.0"
adocn.connectionstring=server.mappath("prices.mdb")
adocn.open

memID=request.querystring("memory")
CPUID=request.querystring("CPU")
monitorID=request.querystring("monitor")



set adors=server.createobject("ADODB.Recordset")
adors.open "SELECT Cost FROM tblMemory WHERE MemID=" & memID,adocn,0,1
response.write "Memory Cost = " & adors.fields(0).value
x=adors.fields(0).value
adors.close


set adors=server.createobject("ADODB.Recordset")
adors.open "SELECT Cost FROM tblCPU WHERE CPUID=" & CPUID,adocn,0,1
response.write "
CPU Cost = " & adors.fields(0).value
y=adors.fields(0).value
adors.close


set adors=server.createobject("ADODB.Recordset")
adors.open "SELECT Cost FROM tblMonitor WHERE MonitorID=" & monitorID,adocn,0,1
z=adors.fields(0).value
response.write "
Monitor Cost = " & adors.fields(0).value
response.write "
TOTAL COST = " & x+y+z & ""

adors.close

adocn.execute "insert into tblMemory (Description) VALUES ('Test')"


adocn.close


</script>





<font face="Arial">Click here to get another price</font></p>



</html>

This code is actually retrieving data from the database, not writing to it. To update data you can use the connection object:-

adocn.Execute "INSERT INTO MyTable (MyField) VALUES '" & request.querystring("emailAddress") & "'"


NOTE : Before this will work you need to ask your host to make the Access file read/write for everyone - by default it's likely that it will be read-only.

------------------------------------------------------------------------------------

I hope that's of some use. Post back if you get stuck with something.
 
Upvote 0
Thanks, i'll get working on that and let you know how I get on.

Thanks for your help.
 
Upvote 0
you dont think you could send me prices.mdb could you just so I can see the back-end also.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,221,539
Messages
6,160,412
Members
451,644
Latest member
hglymph

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top