I am upgrading a database from Access 2010 to Office 365. The issue is the code from Access 97 Developer’s Handbook by Litwin, Getz, and Gilbert (Sybex) Copyright 1997 which has been used since the database was first developed in Access 97 to obtain file and folder information no longer works.
A little additional context. I retired from coding at least 6 years ago so am somewhat rusty and not upto date, however I have been asked to upgrade the database as I am the only one who knows anything about how it operates from the code side.
My problem is that I need to recode so that a user can either select an existing database file or name a new one with one dialog box as it used to work in Access 2010 and prior versions. IF the file was previously created by the database this name should appear in the dialog box but the user should be able to overwrite it and with a new name, ie the decision is the user’s not the coder’s.
I have managed to recode the folder locator and file find sections using Application.FileDialog(msoFileDialogFolderPicker) and Application.FileDialog(msoFileDialogFilePicker).
When I try to either name a new file or select an existing one with the same dialog box:
I have tried to use Application.FileDialog(msoFileDialogSaveAs), but if the file already exists this throws up the following: dbfiles.accdb already exists. Do you wish to replace it.
If I use Application.FileDialog(msoFileDialogFilePicker) I cannot name a new file.
MTrounson is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.