Solved

Export with Workday

Posted on 2011-03-04
9
481 Views
Last Modified: 2012-05-11
Hi,

I have a table in Access 2003 called "GL Balances"

I would like to export this on a form to the below location but naming the file with "Balances 03/03/2011" but i would like the date to change each day. So its like excel =WORKDAY(Today(),-1)

Location

G:\Asset Services MI\UnMatched Merit\Balances

Does anyone have the code to achieve this?

Thanks
Seamus
0
Comment
Question by:Seamus2626
  • 5
  • 4
9 Comments
 
LVL 40

Expert Comment

by:als315
ID: 35035439
It is impossible to save file with "/" in name.
You can use "_" or "-" or "."
0
 

Author Comment

by:Seamus2626
ID: 35035463
Yeah, theres no need for it to have /, 03032011 is fine

Thanks
Seamus
0
 
LVL 40

Expert Comment

by:als315
ID: 35035471
Dim path As String
path = "G:\Asset Services MI\UnMatched Merit\Balances\Balances "
path = path & Format(Now(), "mm_dd_yyyy.xls")
Then you can use this file name in export command.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:Seamus2626
ID: 35035492
Im a code novice, so am womdering where i would put it in the export

I currently export with

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Balances", "G:\Asset Services MI\UnMatched Merit\Balances.xls", True, "GL Balances"

Thanks
Seamus
0
 

Author Comment

by:Seamus2626
ID: 35035520
Also, that looks like today, is there workday-1 in Access code?

Thanks
Seamus
0
 
LVL 40

Expert Comment

by:als315
ID: 35035554
Dim path As String, D As Date
D = DateDiff("d", Now(), 1)
D = DateValue("05.03.2011")
While Weekday(D) = vbSunday Or Weekday(D) = vbSaturday
    D = DateAdd("d", -1, D)
Wend
path = "G:\Asset Services MI\UnMatched Merit\Balances\Balances "
path = path & Format(D, "mm_dd_yyyy.xls")
0
 
LVL 40

Expert Comment

by:als315
ID: 35035557
Remove D = DateValue("05.03.2011") - it was test
0
 
LVL 40

Accepted Solution

by:
als315 earned 500 total points
ID: 35035563
Dim path As String, D As Date
D =  DateAdd("d", -1, Now())
While Weekday(D) = vbSunday Or Weekday(D) = vbSaturday
    D = DateAdd("d", -1, D)
Wend
path = "G:\Asset Services MI\UnMatched Merit\Balances\Balances "
path = path & Format(D, "mm_dd_yyyy.xls")
0
 

Author Closing Comment

by:Seamus2626
ID: 35035697
Thanks!

Seamus
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

828 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