Solved

Save *.snp with current date()  in file name.

Posted on 2008-06-25
2
604 Views
Last Modified: 2013-11-27
I would like to create a batch file or macro to automatically save a *.snp report to a folder with the Date()  in the *.snp file name.   I created a macro that creates the *.snp and saves to a network folder but I need to add the current Date() to the *.snp file name automatically.    What is happening now is, if one user saves the file and forgets to change the name to the date they ran the *.snp and the next user run the report it overwrites the existing copy.  

THOUGHTS
0
Comment
Question by:eyes59
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 18

Assisted Solution

by:jmoss111
jmoss111 earned 200 total points
ID: 21869442
Hope this sample helps you oyt.

Jim
Dim ThisDay As String
Dim ThsDay As String
ThisDay = Date$
' Formats date to ISO format, IE YYYYMMDD
ThsDay = Right([ThisDay], 4) & Left([ThisDay], 2) & Mid([ThisDay], 4, 2)
             DoCmd.OutputTo acOutputReport, "rptHubSummaryWeekToWeek", acFormatSNP, "S:\SiteData\HSV2\Public\AppData\Reports\APWeekly\SupReports\" & ThsDay & "_" & "_RptHubsSummaryCompareWeekToWeek" & ".snp"

Open in new window

0
 
LVL 11

Accepted Solution

by:
RgGray3 earned 300 total points
ID: 21871315
Place the following two functions in a standard module

Build your filename ...

"YourBaseFileName_" & IsoDateFormat(Date()) & ".snp"
(I like underscores seperating the base from the date stamp...  optional)

if multiple copies are needed a day.... use the IsoDateTimeFormat function
Public Function IsoDateFormat(pdtDate As Date) As String
    IsoDateFormat = Year(pdtDate) & Right("0" & Month(pdtDate), 2) & Right("0" & Day(pdtDate), 2)
End Function
Public Function IsoDateTimeFormat(pdtDate As Date) As String
    IsoDateTimeFormat = Year(pdtDate) & Right("0" & Month(pdtDate), 2) & Right("0" & Day(pdtDate), 2) & Right("0" & Hour(pdtDate), 2) & Right("0" & Minute(pdtDate), 2) & Right("0" & Second(pdtDate), 2)
End Function

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question