Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 31st, 2006, 05:30 PM
Authorized User
 
Join Date: May 2006
Location: Nederland, TX, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Save file location code.

I'm trying to save a excel form (populated from Access)
to another folder.
My regular code is:
'================================
FileStr = fso.getparentfoldername(Access.CurrentDb.Name) & "\Trans" & "-" & CompName & "-" & Draftval & "-" & Format(Date, "mmddyy") & "-" & TIDNo

xlDoc.SaveAs FileStr
'================================
This will save to the current database location.
If modified this to save into a new folder location:
'================================

FileStr = fso.getparentfoldername("N:\TransLog") & "\Trans" & "-" & CompName & "-" & Draftval & "-" & Format(Date, "mmddyy") & "-" & TIDNo
xlDoc.SaveAs FileStr

'==================================
This was to save into the folder "N:\translog"
as the file name listed.
Problem, it is still saving in the original folder location.
Can anyone help with the correct code solution?
Thanks

John Paul
__________________
John Paul
Reply With Quote
  #2 (permalink)  
Old June 5th, 2006, 03:13 PM
Authorized User
 
Join Date: May 2006
Location: Nederland, TX, USA.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have found the answer,
Code:
xlDoc.SaveAs ("N:\Forms") & "\Trans" & "-" & TIDNo

I didn't need to use the FSO.getparentfolder in this case.



Thanks

John Paul
Reply With Quote
  #3 (permalink)  
Old June 9th, 2006, 07:50 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Great you found the answer. Hey, just a suggestion since I see you're using the date in your file name. Instead of Format(Date, "mmddyy"), consider Format(Date, "yyyymmdd").

1) Is it Y2K compliant (many IT depts. will not accept two-year digits in anything now).

2) When you use File Manager or Windows Explorer and sort by file name, the file names will sort by year, then month, then day properly. In the other way, they'll sort by month then day then year. Not a typically desired sort. You'll end up with all Januarys for X years first, then all Februarys, etc. instead of one year first then by its months and days, then the next year, etc.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
save in location Archangel Word VBA 1 July 13th, 2007 04:09 PM
File Location AlexSepahpour ASP.NET 2.0 Basics 0 March 11th, 2007 12:58 AM
Configuration file name and location TomH VB Databases Basics 2 September 29th, 2006 06:59 PM
sample code "location not fully trusted" swartzbill2000 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 July 20th, 2005 04:06 AM
Visio Templates for UML Code Generation location Imar General .NET 1 March 6th, 2005 12:44 PM



All times are GMT -4. The time now is 05:53 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.