Solved

Export with Workday

Posted on 2011-03-04
9
508 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
[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
  • 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

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.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

691 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