Results 1 to 4 of 4
  1. #1
    SameerSarswat is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    2

    Convert Short text column to date ms access

    Select * from Table where CDate(CStr(Nz(AnnouncementDate,0))) >=CDate(10-10-2014) and CDate(CStr(Nz(AnnouncementDate,0))) <= CDate(01-10-2014);




    here AnnouncementDate Column is Short Text

    it gives me a type mismatch error..

    please tell me how to solve this.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Try using # delimiters:

    Select * from Table where CDate(Nz(AnnouncementDate,0)) BETWEEN #10/10/2014# AND #01/10/2014#);

    The date range doesn't make sense. Aren't the dates backwards? It does seem to make a difference in my testing.

    Also, CDate(CStr(Nz(AnnouncementDate,0))) will return 12:00:00 AM if the field is null and no records return - is that what you want?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    SameerSarswat is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    2
    Hello Moderater

    its not solving my prob. its sending me same error of type mismatch in criteria exp.

    i have putted like this

    Select * from table
    where CDate(Nz(AnnouncementDate,0)) BETWEEN #10-10-2014# AND #01-10-2014#

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    Works for me.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Convert Text String to Date in SQL
    By kestefon in forum Access
    Replies: 2
    Last Post: 12-04-2013, 03:33 PM
  2. Replies: 3
    Last Post: 09-11-2013, 09:49 AM
  3. Replies: 8
    Last Post: 02-28-2013, 02:21 PM
  4. Convert text date to date value
    By unslog in forum Access
    Replies: 8
    Last Post: 02-01-2012, 12:22 PM
  5. Replies: 1
    Last Post: 08-07-2011, 07:58 AM

Tags for this Thread

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