Marshall Brooks
Member
- Local time
- Today, 12:03
- Joined
- Feb 28, 2023
- Messages
- 707
I have code to basically only allow my FrontEnd to open from the users desktop. Skeleton code looks like this:
Our company is getting ready to implement OneDrive Backup which would copy all of the files from the Desktop (including my Database) to OneDrive.
I want to change the database to open from anywhere in the users directory, EXCEPT the desktop and particurlarly not OneDrive.
One option would be to specify a Directory Name - "C:\Users\<username>\Access Database" for example, and require the database to be there. But I would prefer the database to be able to be located in any folder in the user directory.
In words, I want
If CurrentPath is <any subfolder of C:\Users\<username>\, but not any subfolder of C:\Users\<username>\OneDrive and not any subfolder of C:\Users\<username>\Desktop and not any subfolder of C:\Users\<username>\Documents Then Open Normally.
How would I write this in code? (The wildcards are where I am confused.)
Code:
Location1 = "c:\users\" & GetUserName & "\desktop"
If LCase(CurrentProject.Path) = Location1 Then
' Do nothing
Else
' Close Database with message
End If
Our company is getting ready to implement OneDrive Backup which would copy all of the files from the Desktop (including my Database) to OneDrive.
I want to change the database to open from anywhere in the users directory, EXCEPT the desktop and particurlarly not OneDrive.
One option would be to specify a Directory Name - "C:\Users\<username>\Access Database" for example, and require the database to be there. But I would prefer the database to be able to be located in any folder in the user directory.
In words, I want
If CurrentPath is <any subfolder of C:\Users\<username>\, but not any subfolder of C:\Users\<username>\OneDrive and not any subfolder of C:\Users\<username>\Desktop and not any subfolder of C:\Users\<username>\Documents Then Open Normally.
How would I write this in code? (The wildcards are where I am confused.)