Results 1 to 6 of 6
  1. #1
    joym is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    57

    Question Date and time without separators and a suffix to be added at the back

    On a textbox "date" i use me.txtDate = Now () which displays the current date and time in the format dd/mm/yyyy hh/mm/ss am pm



    i would like this to be displayed without separators as ddmmyyhhmmss and a constant suffix
    eg todays date is 18/05/17 2:37:12 PM i want it displayed as "180517023712 YES"

    is there a way that this can be done

  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
    53,771
    So is textbox bound to a date/time field?
    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
    joym is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    57
    no it is in shorttext format

  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
    53,771
    Okay, try:

    Me.txtDate = Format(Now(), "mmddyyhhnnss") & " YES"

    But why save data in this format? Why not save a true date value and do formatting on report?
    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
    joym is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2017
    Posts
    57
    Quote Originally Posted by June7 View Post
    Okay, try:

    Me.txtDate = Format(Now(), "mmddyyhhnnss") & " YES"

    But why save data in this format? Why not save a true date value and do formatting on report?
    That worked like a charm

    Thou i tried a similar code but the letters did not show
    Me.txtDate = now() & " YES"

    the reason i was testing this was i am trying to produce a unique codes for ticketing and was testing it out on another test access db

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    That should work also. But it would save the date string with separators.
    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. Replies: 1
    Last Post: 10-22-2014, 11:20 AM
  2. Replies: 11
    Last Post: 07-20-2014, 06:22 PM
  3. Calculate DateDiff on Time Added Field
    By athyeh in forum Queries
    Replies: 9
    Last Post: 12-18-2013, 02:10 PM
  4. Adding the Date & Time record added
    By jo15765 in forum Access
    Replies: 2
    Last Post: 11-26-2010, 11:31 PM
  5. File name with date and Time suffix
    By keyies in forum Access
    Replies: 0
    Last Post: 04-29-2010, 05:10 AM

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