Access, ASP and dates

Results 1 to 3 of 3

Thread: Access, ASP and dates

  1. #1
    Ian Watt Guest

    Default Access, ASP and dates

    I have a database table which has amonst others a field "date".<BR><BR>In one ASP page I add a new record and set the fields including the date to now()<BR>:-<BR><BR>Set objRec = Server.CreateObject ("ADODB.Recordset")<BR> objRec.Open "tbl_news", objConn, adOpenStatic, adCmdTable<BR><BR> objRec.Addnew<BR> objRec("date") = now()<BR> .........etc<BR><BR>In another ASP form I open the recordset and want to copy the date from the "date" field to another field "olddate" and re-set the "date" field to now() :-<BR><BR>strSQL = "Select * from tbl_news where id = " & RecordToUpdate <BR> objRec.Open strSQL, objConn, adForwardOnly, adLockPessimistic<BR> <BR> ObjRec("olddate") = objRec("date")<BR> objRec("date") = now()<BR> .........etc......<BR> ObjRec.Update<BR><BR>However, the update method chokes every time. The line that does it is <BR>objRec("date") = now()<BR><BR>every other line that updates a field works ok if I comment *this* line out.<BR><BR>Can anyone suggest why or a work-around?<BR><BR>Thanks<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Access, ASP and dates

    If your database is set as only a date field this might be failing because Now() returns that current date and time. You might want to try using just the date function.

  3. #3
    Ian Watt Guest

    Default RE: Access, ASP and dates

    Thanks Erica. It stores date and time - so that is not an issue.<BR>I think that calling the field "date", which can be a reserved word, was not a good idea. I&#039ve renamed the field and it works now with the Now() function.I need the time aspect to store when records change.<BR><BR>I still can&#039t fathom why the update on one page works and on the other doesn&#039t !<BR><BR>Thanks for you input.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts