In the examples, you are reading in from a form. If I just want to use server variables, I made the changes to the below text. I am getting the well-known "database or object is read-only" error. The database I am using is in the "db" directory on my brinkser account and I know the directory is fine because my other database is working fine. If anyone spots the error right away, please let me know.
Micah
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim newStats 'Holds the recordset for the new record to be added
Dim strSQL 'Holds the SQL query to query the database
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db/stat.mdb")
'Create an ADO recordset object
Set newStats = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT tble.remoteAddress, tble.httpReferrer, tble.httpUserAgent FROM tble;"
'Set the cursor type we are using so we can navigate through the recordset
newStats.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
newStats.LockType = 3
'Open the recordset with the SQL query
newStats.Open strSQL, adoCon
'Tell the recordset we are adding a new record to it
newStats.AddNew
'Add a new record to the recordset
newStats.Fields("remoteAddress") = Request.ServerVariables("REMOTE_ADDR")
newStats.Fields("httpReferrer") = Request.ServerVariables("HTTP_REFERER")
newStats.Fields("httpUserAgent") = Request.ServerVariables("HTTP_USER_AGENT")
'Write the updated recordset to the database
newStats.Update
newStats.Close
Set newStats = Nothing
Set adoCon = Nothing
%>