Computer Learning Zone CLZ Access Excel Word Windows

When scientifically investigating the natural world, the only thing worse than a blind believer is a seeing denier.

-Neil deGrasse Tyson
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Access >
Back to TechHelp    Comments List
Copypath source to destinatn Upload Images   Link   Email  
Mark Niefer 
Richard:

Please consider this question for your Tech-Help-Video Series. I believe it will be a unique addition to your fine video series.


Q: Is it possible to write some VBA code that will copy a file from a source-path to a destination-path?

The source-path: a string, stored in a table-field, and is unique for each record.

The destination-path: a concatenation derived from several fields, located on the Switchboard Form, plus an hourly-timestamp.

The switchboard data: changes with each session, and thus, the destination-path, is changed with each session.

Note A:  Only the path-portion changes (source vs. destination), but the filename-portion, always remains constant. (Aka: I want the original-filename to be retained).

Note B: The Now-timestamp is rounded to the nearest hour, so that all the files I select get copied to the same folder, as per the same hour of day. Therefore, the minutes are substituted by the constant characters of, 00. (To the nearest Hour)

Example is described below:

Button1 Click()
A.) Copy a file whos sourcepath is stored in the table, from a field named [sourcepath].  (as per the current record).
B.) Concatenate [RootFolder] & [UserName] & Now()
C.) Create a new destination-path on the hard drive.
D.) Paste the source-file to the new destination-path.

Source-Path (Stored):
Forms!DataEntryF![SourcePath]  i.e. "D:\documents\machinerymanual.pdf"

Destination Path (volatile per session and computer-clock):
-Derived from a concatenation of 3 fields, from the SwitchboardF form.
-The data on the SwitchboardF is changed with each session, (but [RootFolder] typically remains, constant).

Forms!SwitchboardF![RootFolder]  i.e. "D:\Library"
Forms!SwitchboardF![UserName]  i.e. Ronald
Forms!SwitchboardF![NowstampHH]  i.e. 07152023t1300
Forms!SwitchboardF![DestinationPath]= ([RootFolder] & [NowstampHH] & [UserName])  i.e. D:\Library\07152023t1300_Ronald"

The Execution:
Button 1 Click()
For the current record
cmd
Create [DestinationPath]
Xcopy: [SourcePath], [DestinationPath]

Execution Example:
For the current record
cmd
Create D:\Library\07152023t1300_Ronald\
Xcopy: D:\documents\machinerymanual.pdf, D:\Library\07152023t1300_Ronald\machinerymanual.pdf
Juan C Rivera
Access Developer 31 - File Picker (PickFile)
Will show you what you are looking for.  If this is not let me know I can point you to other videos that have this.

V/r
Juan
Richard Rost
Yeah, I've got lots of different lessons in the Developer series that cover File I/O like this. I'd start with Access Developer 30.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in TechHelp.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 2/24/2024 12:50:43 AM. PLT: 0s