Results 1 to 6 of 6
  1. #1
    mlkshake is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2023
    Posts
    3

    Date in two different formats

    Hello There,



    I would like to display two date formats in two seperate text fields using VBA.


    MM-DD-YYYY source from a text field named Appdate with =Date() as the standard value.


    DD.MM.YYYY source from a text field named Appdate with =Date() as the standard value.


    Any ideas on how I can get dates in the above mentioned values ?

  2. #2
    xps35's Avatar
    xps35 is online now Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    232
    Use the Format function:
    Code:
    Format(Appdate ,"mm/dd/yyyy")
    Format(Appdate ,"dd\.mm\.yyyy")
    Groeten,

    Peter

  3. #3
    mlkshake is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2023
    Posts
    3
    Thank you for the quick reply, and for the solution!

  4. #4
    mlkshake is offline Novice
    Windows 10 Access 2016
    Join Date
    Sep 2023
    Posts
    3
    One question though, how can I make the same formats send the date formats to another form

    ie. Forms!appointment!Format(Appdate, "mm/dd/yyyy")

  5. #5
    Edgar is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Dec 2022
    Posts
    274
    Try:
    Code:
    Format(Forms!appointment!Appdate.Value, "mm/dd/yyyy")
           ^-----------------------------^  ^----------^
                      REFERENCE                FORMAT
    The Format function requires an input and a format, for input, use the value reference, for format, use what you have.
    Please click on the ⭐ below if this post helped you.


  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why would you need VBA for this? Do calc in query or textbox.
    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. VBA from same query returns different date formats
    By Mattbro in forum Programming
    Replies: 5
    Last Post: 05-19-2022, 12:49 AM
  2. Importing csv file with two different date formats
    By robsmith in forum Import/Export Data
    Replies: 36
    Last Post: 03-13-2020, 11:37 AM
  3. Replies: 2
    Last Post: 03-09-2016, 04:15 PM
  4. Matching Date Formats for Query in a form
    By WickidWe in forum Queries
    Replies: 1
    Last Post: 01-15-2014, 03:19 PM
  5. Import Excel and date formats
    By thart21 in forum Import/Export Data
    Replies: 1
    Last Post: 04-19-2011, 03: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