Results 1 to 4 of 4
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    date, assigned in SQL, not displaying / assiging a value as expected


    I have a line of code that assigns a date to a record's field (I ONLY need / want the date; not time; not time and date; just the date ...only)
    it works as anticipated with one exception:

    the date displayed in the document is not what "seems" to be assigned in SQL, it is (always): 30-Dec-1899, and in the record datasheet view it is 12:23:32 AM (also not what i had thought it would be...

    Code:
    Dim sSQL As String
    sSQL = "update tbeAdditionalPages" & _
               " Set CatalogDate = " & Date & " WHERE [Type] = '" & Forms![frmSpec].[Type] & "' AND [BaseCatalogSheet]= true;"
    'Save current record if it has been modified.
    If Me.Dirty Then Me.Dirty = False
    CurrentDb.Execute sSQL, dbFailOnError
    Me.Requery
    the sSQL generates:
    "update tbeAdditionalPages Set CatalogDate = 5/18/17 <ie... whatever is today's date> Where [Type] = <etc.> "

    I suspect it's something as simple as I need to be wrapping the date in "#"s (?)

    many thanks in advance,
    mark

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by markjkubicki View Post
    I suspect it's something as simple as I need to be wrapping the date in "#"s (?)
    That is correct.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    thnx (end of day ...obviously, I ought to head home!!!)

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 15
    Last Post: 12-07-2014, 06:22 AM
  2. displaying date ranges.
    By abodi in forum Queries
    Replies: 4
    Last Post: 08-15-2014, 08:05 AM
  3. Form not displaying Date Picker
    By khughes46 in forum Forms
    Replies: 8
    Last Post: 04-10-2014, 12:56 PM
  4. displaying a date using DLookup
    By crowegreg in forum Forms
    Replies: 2
    Last Post: 08-25-2011, 05:24 PM
  5. Replies: 2
    Last Post: 09-27-2010, 02:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums