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 17 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.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
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.