Solved Handling of address property in hyperlink fields

Harry Paraskeva

Registered User.
Local time
Tomorrow, 01:03
Joined
Sep 8, 2013
Messages
78
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 believe you might be able to get the absolute path if you change the base url property to something like file://
 
I believe you might be able to get the absolute path if you change the base url.
Thank you for the reply. I tried it but worked only for files under relative folder from the frontend. I used the workaround in Note II eventually. I'll post the relevant part of the code when I'm back at the office.
 
maybe you can find this somewhat similar post helpful on your
situation:

i posted a db that convert the // to "real" path names (post #10 and #12).
 
maybe you can find this somewhat similar post helpful on your
situation.

i posted a db that convert the to "real" path names (post #10 and #12).
I would be interested in the solution, but the link to the post was not attached. Could you send it again?

I'll post my solution too once back to the office on Tuesday.
 
maybe you can find this somewhat similar post helpful on your
situation:

i posted a db that convert the // to "real" path names (post #10 and #12).
Arnel, that links to this thread? :)
 
here is the link, post#12.
 
Got it to fully work without ActiveX! It's a drag-and-drop utilising the Hyperlink field's capacity to accept drag-and-drop objects in MS Access and trigger the After Update event. The relevant portion of the code for handling the address is found in the text attached. It would not allow me to post it as code in the forum due to triggering the spam filter of the forum.
 

Attachments

what if the db got relocated, then you need again to figure it out how to address the path?
 
what if the db got relocated, then you need again to figure it out how to address the path?
The DB is installed as a client in Program Files. If someone moves it to a different folder, then all sorts of issues arise, not just with this. It is inflexible by design.
 
goodluck with your inflexible db.
Thank you. It has to be that way because it is utilising inputs from 15 users each one having separate mediums to add images (HDDs, DVDs, memory cards, mapped drives, etc.) and all storing images in a predefined cloud service.
 

Users who are viewing this thread

Back
Top Bottom