Results 1 to 4 of 4
  1. #1
    charly.csh is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2014
    Posts
    186

    Include time in format(YYMMDD)

    Hi everyone,

    I am creating a report with a consecutive name and also want to include the time like HHMMSS but it doesn't work and just shows the format as 000000
    What Do I change to my code on this part?



    Code:
    Private Sub ExportarPdfcmd_Click()
    
    Dim stDocName As String
    Dim stFileName As String
    
    stDocName = "Report_Rpt"
    stFileName = "Report of Open Actions "
    
    'What should be changed on my format?
    DoCmd.OutputTo acOutputReport, stDocName, acFormatPDF, stFileName & Format(Date, "YYYYMMDD-HHMMSS") & " - " & Me.UserNamelbl.Caption, True
    MsgBox "Report", vbInformation, "Testing"
    
    End Sub
    Thanks for the help!!

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    You need to use the Now() function to return time, Date() does not have a time component.
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,540
    Try:
    Format(Date, "YYYYMMDD") & "-" & Format(time,"HHMMSS")
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    charly.csh is offline Competent Performer
    Windows 11 Office 365
    Join Date
    Nov 2014
    Posts
    186
    Great both solutions!!!
    Many thanks!!!

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

Similar Threads

  1. Replies: 22
    Last Post: 09-23-2015, 03:47 PM
  2. Replies: 3
    Last Post: 05-07-2015, 05:37 AM
  3. Replies: 4
    Last Post: 03-19-2015, 08:43 AM
  4. Replies: 1
    Last Post: 08-02-2014, 02:41 PM
  5. Replies: 8
    Last Post: 01-16-2013, 02:10 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