Computer Learning Zone CLZ Access Excel Word Windows

If we are not able to ask skeptical questions, to interrogate those who tell us that something is true, to be skeptical of those in authority, then, we are up for grabs for the next charlatan (political or religious) who comes rambling along.

-Carl Sagan
Home   Courses   Index   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 
11 months ago

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
Create [DestinationPath]
Xcopy: [SourcePath], [DestinationPath]

Execution Example:
For the current record
Create D:\Library\07152023t1300_Ronald\
Xcopy: D:\documents\machinerymanual.pdf, D:\Library\07152023t1300_Ronald\machinerymanual.pdf
Juan C Rivera             
11 months ago
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.

Richard Rost             
11 months ago
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.

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

Copyright 2024 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 6/15/2024 6:16:39 AM. PLT: 1s