Access Developer 31
VB File, Folder Nav, Copy Files, Compact BEs
Today's class continues our work with Classic VB File Handling. We will start out learning how to navigate between files and folders, select files with the file picker, launch files with ShellEx, copy files, create folders, and more. Then we'll learn how to automatically compact multiple back-end files. Lots to do in this class!
In Lesson 1, we start off with VB file and folder navigation, creating your own file browser, launching applications with the ShellExecute function, and using the standard Windows file picker.
In Lesson 2, we're going to learn how to copy files. We'll learn the FileCopy command. We'll create a central Images folder on your database server. We'll learn how to check to see if a file and folder exists. We'll create a folder with the MkDir command. We'll read the user's Windows system environment variables so we can determine where their User folder is and set that as the default file browse location. We'll store the last folder browsed in a TempVars variable. We'll learn how to separate filename and folder from the full path. We'll see how to get the length of a file with FileLen to check and make sure that the file copied 100% completely.
In Lesson 3, we will delete the old profile picture if a new one is selected with the Kill command. We'll ask the user first if it's OK before continuing, of course. We're not animals. We will verify the file has been deleted. We will timestamp new files as they are copied so that we don't run into duplicate filenames. We'll discuss error handling ramifications and best practices with File I/O functions. We'll see how to rename a file. I'll also talk about ChDrive and ChDir, although I almost never use them.
In Lesson 4, we will design a form to auto-compact multiple backend ACCDB files. If you have a split database and have multiple backend linked files, you'll be able to compact them all on a regular basis (like once a week) with a single click of a button. The database will allow you to pick your BE folder, loop thru the ACCDB files in that folder with a DIR, backup each file with a timestamp, compact it, and verify everything was done correctly. This one is a real time saver if, like me, you've got a dozen or so BE files.
Enroll now so that you can watch these lessons, learn with us, post questions, and more.
Please feel free to post your questions or comments below. If you are not sure as to whether or not this product will meet your needs, I'd rather help you before you buy it. Remember, all sales are final. Thank you.
Subscribe to Access Developer 31
Get notifications when this page is updated
Check out these other pages that may be of interest to you: