Results 1 to 11 of 11
  1. #1
    Akchayan is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Aug 2022
    Posts
    102

    Date Format


    Hello everyone,


    I would like the date to be printed in this format: "YYMMDD". For example, today's date: "220921".
    Is it possible to change this here?

    Click image for larger version. 

Name:	Screenshot 2022-09-21 121305.png 
Views:	21 
Size:	35.5 KB 
ID:	48747


    Thanks for the help!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Don’t put it in the table,
    do it in the query or report:
    qry: forrmat(field,”yymmdd”)

    rpt: set format property same, yymmdd

  3. #3
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    300
    Just try it!

  4. #4
    Akchayan is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Aug 2022
    Posts
    102
    Quote Originally Posted by ranman256 View Post
    Don’t put it in the table,
    do it in the query or report:
    qry: forrmat(field,”yymmdd”)

    rpt: set format property same, yymmdd

    Where do i write the code for "rpt: set format property same, yymmdd", into vba right?

  5. #5
    Join Date
    Apr 2017
    Posts
    1,793
    Use a query as Source of report. In this query, have a field formatted as adviced above, i.e. something like
    Code:
    SELECT field, field2, ...,  YourDateField, Format(YourDateField,"yymmdd") AS YourDateString, ... FROM YourTable ..."
    In report, use the field YourDateString do display formatted date.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Quote Originally Posted by Akchayan View Post
    Where do i write the code for "rpt: set format property same, yymmdd", into vba right?
    No, in the same property of the control in the report?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,823
    Hi

    No, on the Report in Design View you would select the Control "AngebottNr" and then change the Properties of the Control as specified.

  8. #8
    Akchayan is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Aug 2022
    Posts
    102
    I don't quite understand because I want today's date. So I always want to output the current date in the format "yymmdd" and I don't quite understand how I have to do that with the code snippets from you.

  9. #9
    Join Date
    Apr 2017
    Posts
    1,793
    Quote Originally Posted by Akchayan View Post
    ... I always want to output the current date in the format "yymmdd"...
    Code:
    SELECT ... FORMAT(DATE(),"yymmdd") AS ReportDate,  ...

  10. #10
    Akchayan is offline Competent Performer
    Windows 7 64bit Access 2016
    Join Date
    Aug 2022
    Posts
    102
    I have a report, this desired output should come in a text field, can't I do this directly in the text field?

  11. #11
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,574
    Quote Originally Posted by Akchayan View Post
    I have a report, this desired output should come in a text field, can't I do this directly in the text field?
    Yes, as you tried in the table?
    Set the controlsource to =Date() or whatever your Date() is in your language
    Then set the format as desired
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Replies: 6
    Last Post: 04-06-2020, 04:31 AM
  2. Replies: 2
    Last Post: 01-14-2018, 08:59 PM
  3. Replies: 3
    Last Post: 12-30-2016, 10:27 AM
  4. Replies: 3
    Last Post: 08-20-2014, 01:47 PM
  5. Replies: 4
    Last Post: 03-12-2013, 06:49 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