Locate google drive local path using VBA (1 Viewer)

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
In an Access database, I let users chose between many different cloud systems to store file attachments, while I just store a relative path in an Access table, e.g. MyAppFiles\123\filename.jpg, and it knows from the Cloud Service setting what cloud system to look for to get the complete path.

CloudStorage.jpg

For a single user this is simple, but on a multiuser system the path various for each user, so a method to reliably locate the path is necessary.

I've been trying to find out how to locate the Google Drive for individual users using VBA. In the past, I simply looked for "C:\Users\" & Environ("UserName") & "\Google Drive", but this is not a reliable method. Has anyone had any success finding a way to do this?
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:27
Joined
Sep 21, 2011
Messages
14,310
Perhaps inspect the registry?
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
I've looked everywhere in the registry as well as in all the files within the "Base Path": C:\Users\morte\AppData\Local\Google\DriveFS
 

isladogs

MVP / VIP
Local time
Today, 20:27
Joined
Jan 14, 2017
Messages
18,228
Have you checked whether there is an Environ value for this?
Code:
Sub ShowEnviron()

'lists all envionment variables
    Dim strg As String
    Dim x As Long

    strg = "Environ Values 1  to 50" & vbCrLf & _
    "=======================" & vbCrLf
    For x = 1 To 50
        strg = strg & x & "  " & Environ(x) & vbCrLf
    Next x
    
    Debug.Print strg

End Sub

I don't use GoogleDrive so am unable to test
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:27
Joined
Sep 21, 2011
Messages
14,310
None on my computer?
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
Have you checked whether there is an Environ value for this?
Code:
Sub ShowEnviron()

'lists all envionment variables
    Dim strg As String
    Dim x As Long

    strg = "Environ Values 1  to 50" & vbCrLf & _
    "=======================" & vbCrLf
    For x = 1 To 50
        strg = strg & x & "  " & Environ(x) & vbCrLf
    Next x
   
    Debug.Print strg

End Sub

I don't use GoogleDrive so am unable to test
Tested, but no. Good suggestion though
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:27
Joined
Sep 21, 2011
Messages
14,310
I certainly have the following ?
1664826067016.png
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:27
Joined
Sep 21, 2011
Messages
14,310
Have you actually asked in any google forum?
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
No, I started here. I have asked Google support for documentation and help. But I will do.
 

Gasman

Enthusiastic Amateur
Local time
Today, 20:27
Joined
Sep 21, 2011
Messages
14,310
Try their community forums. You never know. :)
 

bastanu

AWF VIP
Local time
Today, 12:27
Joined
Apr 13, 2010
Messages
1,402
Looks like you can overwrite the user's setting with the admin DefaultMountPoint setting:
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
Looks like you can overwrite the user's setting with the admin DefaultMountPoint setting:
That is a possibility, but they have added an additional folder layer, "My Drive". The user can't create anything in root location, but have to do it inside My Drive. It's possible that I have to have my users move to this new location to make it work, but first I will wait for potential answers to solve the problem without too much hassle.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:27
Joined
Feb 28, 2001
Messages
27,188
Wait a moment...

You are talking about file attachments and you named a .JPG (picture) file. Are you displaying a picture as part of (perhaps) a personnel database form / report and storing that picture on a cloud drive? If so, I wonder whether this would even be possible because of the implications of using Access file access methodology (SMB protocol) on a cloud server. If that attachment has to be used later by the Access DB, I would be worried about its stability. Not pointing fingers, just expressing concern.
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
No, no database on the cloud servers, only files like images, with a link to the file stored in the table. And Yes, I am showing the images in a form. That part works fine. It has worked for a long time using OneDrive, Dropbox, SharePoint, Box and Google Drive. It's just that Google has changed how things work on the Windows desktop recently.
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
Wait a moment...

You are talking about file attachments and you named a .JPG (picture) file. Are you displaying a picture as part of (perhaps) a personnel database form / report and storing that picture on a cloud drive? If so, I wonder whether this would even be possible because of the implications of using Access file access methodology (SMB protocol) on a cloud server. If that attachment has to be used later by the Access DB, I would be worried about its stability. Not pointing fingers, just expressing concern.
By the way, my users are using either an Access backend or a MySQL backend stored locally or remotely in our data center. All three works beautifully. The remote "hybrid cloud" solution became very popular when they had to vacate their offices early in the pandemic.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 14:27
Joined
Feb 28, 2001
Messages
27,188
If you are happy then fine. I'm just a skeptic of any sentence that contains the words "Access" and "cloud" together.
 

mor10

Member
Local time
Today, 14:27
Joined
Feb 15, 2016
Messages
37
If you are happy then fine. I'm just a skeptic of any sentence that contains the words "Access" and "cloud" together.
Our cloud solution keeps the Access front end locally and a MySQL database remotely. Works fine.
 

Users who are viewing this thread

Top Bottom