Results 1 to 5 of 5
  1. #1
    Rzadziu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    28

    Date converting

    Hello,

    Im trying to convert this 20071105 in to this 05.11.2007 directly in query unfortunately without good resoult.
    I have try to do this also in raport by using =DateSerial(Left([EXP];4);Mid([EXP];5;2);Right([EXP];2)) but when field EXP is zero i got an error.

    It is possible to convert it in some other way.

    BR Marcin

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    The semi-colon works?

    What date do you want to show if EXP has 0?

    DateSerial(Left(IIf([EXP]=0,"00000000",[EXP]),4),Mid(IIf([EXP]=0,"00000000",[EXP]),5,2),Right(IIf([EXP]=0,"00000000",[EXP]),2))
    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
    Rzadziu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    28
    Hello June7,

    Thanks for your quick reply,

    When EXP is 0 then on Report it should not be visible.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Calculate the date conversion in query. Force the date to be some impossible value, like 1/1/1900. Use 19000101 in place of 00000000.

    Then another calculation in query references the converted date field or in textbox: IIf([fieldname]=1/1/1900, Null, [fieldname])
    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.

  5. #5
    Rzadziu is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2012
    Posts
    28
    Thanks June7

    Problem solved

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

Similar Threads

  1. Converting DATE & Time
    By johnseito in forum Access
    Replies: 8
    Last Post: 10-05-2013, 10:28 AM
  2. Converting a string to date/time
    By RayMilhon in forum Programming
    Replies: 8
    Last Post: 09-28-2012, 10:02 AM
  3. Converting date field in numbers
    By mercapto in forum Queries
    Replies: 5
    Last Post: 04-19-2012, 11:35 AM
  4. Converting a date to length of time
    By Duncan in forum Access
    Replies: 2
    Last Post: 11-10-2010, 05:53 AM
  5. Replies: 2
    Last Post: 07-03-2010, 08:45 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