Update date field in Access

Results 1 to 2 of 2

Thread: Update date field in Access

  1. #1
    Join Date
    Dec 1969

    Default Update date field in Access

    I have the following code:<BR>Sub Dt_Updtd()<BR> Dim DateConn as OleDbConnection<BR> Dim DateUpdate as New OleDbCommand<BR> <BR> DateConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:...Database.mdb")<BR> DateUpdate.CommandText = "Update tblEquifaxDates Set DateUpdated = " & Now() & " Where CaseNumb = " & Session("CaseNumb")<BR> DateUpdate.Connection = DateConn<BR> DateUpdate.Connection.Open<BR> DateUpdate.ExecuteNonQuery()<BR>End Sub<BR><BR>When this sub is called, I get this error:<BR>System.Data.OleDb.OleDbException: Syntax error (missing operator) in query expression &#039;10/6/2003 4:37:13 PM&#039;. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at ASP.EquifaxReport_aspx.Dt_Updtd() in c:inetpubwwwrootlifeguardsecureEquifaxReport.aspx: line 128 at ASP.EquifaxReport_aspx.butUpdate_Click(Object sender, EventArgs e)<BR><BR>Would someone please tell me what I am doing wrong?<BR><BR>TIA!

  2. #2
    Join Date
    Dec 1969

    Default RE: Update date field in Access

    You need to put quotes around your date in SQL you would use &#039; I think its a little different with Access it might be a # around the date.

Posting Permissions

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