Harry Paraskeva
Registered User.
- Local time
- Today, 05:20
- Joined
- Sep 8, 2013
- Messages
- 68
Hello to all...I have run into an interesting issue and if someone is able to help, it would be much appreciated.
I have constructed a MySQL database for the backend and an MS Access frontend in 64-bit. The issue is the following...I have been trying to create a drag-and-drop feature for the end-user to be able to drop any file on a hyperlink field (for this I created a local table, as MySQL does not support the hyperlink data type in the same way that MS Access does) and this action triggers the After_Update event, which in turn does three things:
- Copies the digital file to a certain location. The location is created dynamically from other data in parent forms of the subform that carries the hyperlink field.
- Dynamically creates the address towards the file and stores it as a link in a field of the parent form. There is also a photo field that displays a preview of the file if it is an image.
- Deletes all rows in the local table of the hyperlink field.
Basically, the hyperlink is a vehicle to allow drag-and-drop functionality without ActiveX.
The issue I have is that the string variable created to store the source path to the file, which in turn would allow the CopyFile method to properly function, gets populated from this line of code: "Me.DragDropIN.Hyperlink.Address", which in turn does not provide an absolute path, but a relative path, even if the location of the frontend is in a different folder (frontend is in Program Files, files dropped can be anywhere on the computer, such Desktop, Downloads, Pictures folders, another drive or a mapped network drive, or even OneDrive or NextCloud folders). The output of the line of code thus is usually of this type: "..\..\Files\Images\example.jpg".
The question thus is the following: Is there a way to get the absolute path to the files dropped?
Note I: I don't want to rely on ActiveX (so no Microsoft Forms 2.0 dependency or extra plugins), I don't want to call a FileDialog for the user to reselect the file they already dropped, and I can't use the CurrentProject.Path, as the relative path of the frontend.
Note II: I already know I can use InStr or Mid expressions to replace characters of the string with something like "C:\", then check for whether the file exists before trying to copy it with CopyFile. I am just asking if there is a more elegant solution.
I have constructed a MySQL database for the backend and an MS Access frontend in 64-bit. The issue is the following...I have been trying to create a drag-and-drop feature for the end-user to be able to drop any file on a hyperlink field (for this I created a local table, as MySQL does not support the hyperlink data type in the same way that MS Access does) and this action triggers the After_Update event, which in turn does three things:
- Copies the digital file to a certain location. The location is created dynamically from other data in parent forms of the subform that carries the hyperlink field.
- Dynamically creates the address towards the file and stores it as a link in a field of the parent form. There is also a photo field that displays a preview of the file if it is an image.
- Deletes all rows in the local table of the hyperlink field.
Basically, the hyperlink is a vehicle to allow drag-and-drop functionality without ActiveX.
The issue I have is that the string variable created to store the source path to the file, which in turn would allow the CopyFile method to properly function, gets populated from this line of code: "Me.DragDropIN.Hyperlink.Address", which in turn does not provide an absolute path, but a relative path, even if the location of the frontend is in a different folder (frontend is in Program Files, files dropped can be anywhere on the computer, such Desktop, Downloads, Pictures folders, another drive or a mapped network drive, or even OneDrive or NextCloud folders). The output of the line of code thus is usually of this type: "..\..\Files\Images\example.jpg".
The question thus is the following: Is there a way to get the absolute path to the files dropped?
Note I: I don't want to rely on ActiveX (so no Microsoft Forms 2.0 dependency or extra plugins), I don't want to call a FileDialog for the user to reselect the file they already dropped, and I can't use the CurrentProject.Path, as the relative path of the frontend.
Note II: I already know I can use InStr or Mid expressions to replace characters of the string with something like "C:\", then check for whether the file exists before trying to copy it with CopyFile. I am just asking if there is a more elegant solution.