Almost working Drag & Drop

Juice

New member
Local time
Today, 13:29
Joined
Jan 20, 2025
Messages
3
Hi everyone,

A have a somewhat working drag and drop solution, just needs some fine tuning. I have a combo box and a table behind it that has a Hyperlink. If its just a combo box, its not working (you need a table with a Hyperlink table field), but since i need other functions, like "Save as" or "Send it in mail", I can add it in the table and code on it.

When you drop a file onto the combo box (sometimes you need to click the empty text part), it reads out the file path. The problem is that its not getting the full path.

Example: I drop a file with a path "c:\1\example.pdf" but when i read out the text from the combo box, it looks like this: "..\..\..\1\example.pdf" (in Hyperlink terms you see this: ..\..\..\1\example.pdf#..\..\..\1\example.pdf#

Fun part is that i have an older mdb thats used in an office and it works fine, but i cant recreate it.

The older one and this one is made in access 2003 on Win7 OS (people that use it dont want to upgrade)

Anyone has any idea how to set it up so i can get a "normal" path where the drive letter is visible?
 

Attachments

Without downloading your Test.mdb and the way you describe the path return, I suspect that for some reason a relative path is returned. This probably refers to the position of your MDB. Just add the path of your MDB (without the file name of the MDB) and the relative path together and you should have a complete path that Windows understands.
 
Here is a working file drag and drop demo. I am interested is some code using native controls so would like to see what you really have.

dd.PNG
 

Attachments

I cannot imagine this thing does anything nor can I even guess the issue. There are no tables, no code, no means to do drag and drop. There is nothing there. Unless there is some hidden stuff somewhere. You will need to provide something realistic to even have a conversation on how to do drag and drop..
What you see in the test mdb, thats the base of it. I somehow made it work 10+ years ago and i cant seem to figure out how :D
 
Here is a working file drag and drop demo. I am interested is some code using native controls so would like to see what you really have.

View attachment 118117
Thanks i test it tomorrow. I post you some code tomorrow too, but the gist of it is i get the path, copy the file to a network drive then put that network path in a table and for the coworker how handles the bills and stuff. And when she click on the field that has the network link, it opens.
 
I see now how this is supposed to work. I was thrown off by the combo box. I do not know how you can get a absolute path /UNC from a relative path.
Anyways what you are describing is a relative path and not a UNC/Absolute Path.
The HyperlinkAddress property can contain an absolute or a relative path to a target document. An absolute path is a fully qualified URL or UNC path to a document. A relative path is a path related to the base path specified in the Hyperlink Base setting in the DatabaseNameProperties dialog box (available by clicking Database Properties on the File menu) or to the current database path. If Microsoft Access can't resolve the HyperlinkAddress property setting to a valid URL or UNC path, it will assume you've specified a path relative to the base path contained in the Hyperlink Base setting or the current database path.

What is strange is I cannot get your demo or mine to return the relative path. They both return absolute paths. However, if I remember at one time the default was relative path. If I look at your hyperlink base property it is blank.
Setting the hyperlink base property" refers to specifying a default directory or URL path within a document or application, so that when you create hyperlinks, they are automatically considered relative to that base path, meaning you only need to enter the filename or a relative path instead of the full absolute address each time
 
Last edited:
here is what ChatGPT has to say.
see the code in AfterUpdate of the combobox and Module1.
 

Attachments

Users who are viewing this thread

Back
Top Bottom