Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2005

    Unanswered: Report Name/Caption

    I have a form, with a command button that emails a report. I would like to incorporate the date in the report name (sent as a snp file). I can set the caption in the report 'on open' event with me.caption="name" & now(), but when the file shows up in the amail, it is named for the query the report is bound to. If I use the caption property of the report, that is the name that shows up as the attachment, but the caption property cannot take a string expression to add the date.
    Any suggestions?

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    I've used the following code to redefine a report title / caption on load event.

    Me.Caption = strPrefix & "_" & Me.Name & "_" & Format(Now(), "yyyy-mmm-dd")

  3. #3
    Join Date
    Apr 2003
    Alabama, USA
    Do a Debug.Print on whatever string you set your caption to. It probably contains a "/" in it or some other invalid character for a file name. Which is the reason you need to format Now() by using Format(Now(), "yyyy-mmm-dd") as healdem suggested.

    Putting the date in the Year-Month-Day order is also great for sorting files properly by date. Personally, I would do it as "yyyy-mm-dd", see here for my reason why.

    You live and learn. At any rate, you live. - Douglas Adams

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts