Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

inserting automatic date into Access DB

Status
Not open for further replies.

guineamation

Programmer
Jan 29, 2002
58
IL
What statement would insert a date automatically into a cell of each record updated from an ASP form into an Access DB?
 
I found this piece of code on page 661 from ASP 3.0 book writen by David Buser, which can solve your problem. You can try it.

<!--#include file=&quot;Clssfd.asp&quot;-->
<%
Dim rsUsers
Set rsUsers = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsUsers.Open &quot;Person&quot;, objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable

If Session(&quot;PersonID&quot;) <> &quot;&quot; Then ' currently logged-on user
rsUsers.Filter = &quot;PersonID = '&quot; & Session(&quot;PersonID&quot;) & &quot;'&quot;
Else ' New session
rsUsers.Filter = &quot;EMailAddress = '&quot; & Request.Form(&quot;email&quot;) & &quot;'&quot; & _
&quot;AND Password = '&quot; & Request.Form(&quot;password&quot;) & &quot;'&quot;
If rsUsers.EOF Then ' User not found
rsUsers.AddNew ' ...so add a new record
' Else
' Email address and password matched with DB records -
' In this case we'll allow this to update user's personal details
End If
End If
' write personal details to record
rsUsers(&quot;EMailAddress&quot;) = Request.Form(&quot;email&quot;)
rsUsers(&quot;Password&quot;) = Request.Form(&quot;password&quot;)
rsUsers(&quot;FamilyName&quot;) = Request.Form(&quot;FamilyName&quot;)
rsUsers(&quot;GivenName&quot;) = Request.Form(&quot;GivenName&quot;)
rsUsers(&quot;StreetAddress1&quot;) = Request.Form(&quot;Address1&quot;)
rsUsers(&quot;StreetAddress2&quot;) = Request.Form(&quot;Address2&quot;)
rsUsers(&quot;City&quot;) = Request.Form(&quot;City&quot;)
rsUsers(&quot;State&quot;) = Request.Form(&quot;State&quot;)
rsUsers(&quot;PostalCode&quot;) = Request.Form(&quot;PostalCode&quot;)
rsUsers(&quot;Country&quot;) = Request.Form(&quot;Country&quot;)
rsUsers(&quot;Active&quot;) = True
rsUsers(&quot;LastLogin&quot;) = Now
rsUsers.Update ' update the database

Dim strName, strValue ' create session variables
For each strField in rsUsers.Fields
strName = strField.Name
strValue = strField.value
Session(strName) = strValue
Next
Session(&quot;blnValidUser&quot;) = True ' declare that current user is validated
Response.Redirect &quot;MenuForRegisteredUsers.asp&quot;
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top